Enable PHP LDAP Module (XAMPP)


To totally unlock this section you need to Log-in


Login

Connection to LDAP in PHP isn’t that easy task by itself. Things get even more complicated, if you’re working in XAMPP environment under Windows. It hope this article will help you in getting un-stuck, if you’re stuck on the similar things.

As in our experience, on a very rare situation, we were required to use Windows Active Directory or OpenLdap as our user database in WordPress. We need to enable php ldap module in XAMPP. By default this php ldap module is not enable in XAMPP as most web servers are not using ldap as their database or directory. Follow these simple steps to enable this module.

To use LDAP support in PHP served under Windows you need to have three libraries:

libsasl.dll
ssleay32.dll
libeay32.dll

You have to put them into system32 folder, if you’re serving your PHP through XAMPP.

You need to have libsasl.dll library not only for very old PHP 4.3 or older. Even newest versions of PHP 5.3 and above require this lib.

What is even more strange, I had this library (along with required ssleay32.dll and libeay32.dll) in my PHP’s directory and my PHP’s directory was listed in Windows’ PATH variable. And even so, I’m facing the problem of Apache failing to start. The only workaround, I found, was to copy libsasl.dll to system32 system directory.

Enable support

You have to edit your php.ini file and uncomment extension=php_ldap.dll line. Then you have to restart your Apache / XAMPP server.

If you don’t have above mentioned libraries, next run of server will fail with information, which directory is missing. Newest XAMPP brings these libraries in XAMPP's php folder, so you only have to copy them to system32 folder, because for some strange reason, libraries in XAMPP's php are not loaded, though all of them are in PATH system environment variable.

Copy all of these libraries (or just libsasl.dll, as many other programs are using ssleay32.dll and libeay32.dll libraries and one of them could already put these two libs) to your system32 folder.

Procedure

To enable php ldap module in XAMPP, find the following files and copy them to C:\Windows\system32\.

libsasl.dll
ssleay32.dll
libeay32.dll

Enable PHP LDAP Module (XAMPP)

Find and edit C:\xampp\php\php.ini and uncomment "extension=php_ldap.dll" around line 965.

Enable PHP LDAP Module (XAMPP)

Enable PHP LDAP Module (XAMPP)

Restart XAMPP (restart Apache service) and you should now have access to the PHP LDAP functions.

Enable PHP LDAP Module (XAMPP)

You can check ldap functions enabled in ldap by clicking phpinfo() in http://localhost/xampp/.

Enable PHP LDAP Module (XAMPP)