Php – Getting LDAP running with PHP on 2008 R2

apache-2.2ldapPHPwindows-server-2008-r2

I'm having trouble getting the php ldap extension running on my web server, which is running 2008 R2.

Install Notes

  1. Apache: httpd-2.2.16-win32-x86-no_ssl.msi
  2. PHP : VC6 x86 Thread Safe (2010-Jul-21 20:06:17) (ZIP)
  3. adLDAP.php

Steps I've taken

  1. Made sure php_ldap.dll is in C:\PHP\ext (I had to get this from http://bugs.php.net/bug.php?id=46971)
  2. Made sure libeay32.dll and ssleay32.dll are in C:\PHP
  3. C:\PHP has been added to PATH
  4. extension=php_ldap.dll is uncommented in php.ini
  5. extension_dir is set to C:\PHP\ext in php.ini
  6. ran a phpinfo(); the correct php.ini is being loaded, but ldap is not initialized

I'm really at a loss for what might be happening, when I try and use the extension I get the following error (expected since it didn't load):

exception 'adLDAPException' with message 'No LDAP support for PHP. See: http://www.php.net/ldap' in C:\Website\hmis\adLDAP.php:338 Stack trace: #0 C:\Website\hmis\login.php(10): adLDAP->__construct() #1 C:\Website\hmis\index.php(2): require_once('C:\Website\hmis...') #2 {main}

Does anyone have any advice on what might be going wrong? Thanks.

Edit: So it seems like php_ldap.dll is missing from 5.3.3 VC6 builds, I got my copy from a 5.3.1 VC6 build. Could that be causing issues? I'm using apache so I can't use the official VC9 PHP builds, should I try to use ApacheLounge builds? I don't think it should be necessary because I got LDAP working with the official builds for 5.3.1

Edit 2: So the other thing I've tried is completely removing the php_ldap.dll from C:\PHP\ext . I get the exact same error as before, and apache doesn't crash as I would expect it to. Shouldn't it not be able to start with a missing extension?

Best Answer

I had a similar issue on a 2008 box. My problem turned out to be a result of incorrect dll's. Probably worth making sure they are from the thread-safe version. Hope this helps.