Page 1 of 1

ldap_bind success WinXP with xampp but not Linux [SOLVED]

PostPosted: 19. December 2011 13:37
by JerseySmith
I can successfully do LDAP authentication with a PHP script running on XAMPP on Windows XP. But I copied this same script to an Apache on Linux Red Hat with no XAMPP and the ldap_bind call nows gives me the following error:

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server

My Windows XAMPP info is as follows:
Windows 5.1 Build 2600 Platform 2 Service Pack 3

PHP version: 5.3.8
Apache version: 2.2.21
LDAP: OpenLDAP, RCS Version: $ld: ldap.c 313665 2011/07/25 11:42:53, API version 3001, Vendor Version 20319

My Red Hat Linux box without XAMPP:
PHP version: 5.1.6
Apache version: 2.2.3
LDAP: OpenLDAP, RCS Version: $ld: ldap.c, v 1.161.2.3 2006/01/01 12:50:08, API version 3001, Vendor Version 20343

I can ping the LDAP server from both Linux and Windows machines.

I can telnet on the LDAP server with port 3268, so it doesn't seem to be a network connectivity issue…

Would anyone have any ideas?

Re: ldap_bind success WinXP with xampp but not Linux

PostPosted: 19. December 2011 16:19
by JerseySmith
It is working now on the Linux machine.

Both the Windows and Linux machine were using OpenLDAP, but the LDAP on the Linux machine was not properly configured to connect to the LDAP server. The fix was to alter a file /etc/ldap.conf. The settings in this file were not correctly set. Trial and error altering the settings in this file to match what was used in Windows. The key setting seemed to be 'port'. 'port' in this file was originally set to 389, supposedly the default. Changed this to 3268. Restarted Apache and tried the authentication again and it worked. Also commented out 'base' parameter. Base not needed since LDAP is in a Windows domain.

This shows how good it can be to develop with XAMPP. XAMPP for Windows in this case had the proper LDAP settings so I could do LDAP calls from PHP without problems. On the Linux machine however, trial and error and half a day to get LDAP working properly. XAMPP can be a real time saver. Thanks XAMPP!!

Re: ldap_bind success WinXP with xampp but not Linux

PostPosted: 19. December 2011 16:50
by Sharley
Thanks for the feed back. 8)

Best wishes. :)