I've installed PHP in my Win Server 2008 using Web Platform Installer. The installation was success and I can correctly display phpinfo page from my virtual directory. How can I enable LDAP support? c:\Program Files\PHP\Ext\ doesn't contain php_ldap.dll. Do I have to download this file first?

Edit :

  • I'm using Win Svr 2008 Standard Edition, updated to the latest patch
  • The PHP Version is 5.2.11
  • extension_dir is c:\Program Files\PHP\ext\ (as confirmed by phpinfo())
  • I already downloaded the full PHP zip package (10 megs), and : copythe contents of ext dir to c:\Program Files\PHP\ext\
  • I've already modified the php.ini to include php_ldap.dll extension
  • Here's the screen capture of my phpinfo test page

and the LDAP extension is still not working.

  • Can you create a phpinfo file and see if the module is actuall loading? – Sam Cogan Oct 13 '09 at 8:34
  • I've created phpinfo file, and the ldap module is not loaded at all. – Salamander2007 Oct 14 '09 at 2:19

Your best bet would be to download the latest Zip version of PHP from the PHP.net site and get the DLL from that and extract the DLL file from that.

Not sure why its not included with the web platform installer, seems a little odd.

  • in my case also need add these line without semicolumns to php.ini --> ;extension=pcre.so also ;extension=spl.so – saber tabatabaee yazdi Mar 24 at 15:16

I had to enable the module in IIS

start iis manager on windows Server 2008r2

navigate to the root site.

download, install and start php manager (won't install with WordPress over WPI).

scroll to the bottom and click "Enable or disable an extension"

scroll down to the disabled section click on php_ldap.dll to highlight then on the upper right section under actions click "Enable"

exit out and ldap is installed for PHP 5.3.1 that was installed via the "Microsoft Web Platform Installer" when you install "WordPress".


In my case:
* Windows Server 2008 R2
* PHP 5.3 via WebPlatformInstaller

The Error line was:

PHP Fatal error:  Call to undefined function ldap_connect() in ...Tageskonto.php on line 19

has helped to extend the file
* c:\program files (x86)\php\v5.3\php.ini
to load the dll:

  • in my case also need add these line without semicolumns to php.ini --> ;extension=pcre.so also ;extension=spl.so – saber tabatabaee yazdi Mar 24 at 15:16

On Linux, LDAP is often an optional extension to PHP and needs to be installed separately. This may be the case with Windows too.


If you've uncommented php_ldap.dll in extension section of PHP, I believe that PHP doesn't read proper php.ini.

  • IIRC I always installed PHP to path without spaces in path (e.g. C:\PHP).
  • Try copying C:\program files\php\php.ini to C:\windows\ and restart Apache/IIS.

Maybe some of this helps you.

  • I think the PHP.ini load successfully because phpinfo() yields "Loaded Configuration File : C:\Program Files\PHP\php.ini" – Salamander2007 Oct 13 '09 at 6:58
  • Did you try it? IIRC I had trobles enabling extensions... and I solved it by moving php.ini to the right place and finally setting proper PATH variable. – blank3 Oct 13 '09 at 10:49

So you may need to check the following things at phpinfo():

  1. If you are using IIS, check to make sure that your IIS Worker Process has read access on NTFS to your "C:\Program Files\PHP" directory. This Worker Process could be NETWORK SERVICE or IWAM_<computername> or LOCAL SYSTEM (I hope not).
  2. When you load up phpinfo(); in the output check the following lines to ensure they are where you expect it to be:
    -- extension_dir
    -- Loaded Configuration File
    These items need to be where you expect them to be reporting and not loaded from some place else.
  3. You also need to add files to the system's "PATH": libeay32.dll and ssleay32.dll, and will likely require a system restart to pick up; and as some users have documented, putting the PATH near the beginning of the PATH variable may eliminate some problems. This is documented here: http://us2.php.net/manual/en/ldap.installation.php
  • Loaded Configuration File : C:\Program Files\PHP\php.ini – Salamander2007 Oct 14 '09 at 2:07

I didn't read the original question enough to see he already enabled php_ldap.dll, but that was my problem.

On a recent (early 2014) WPI install, the php_ldap.dll is there and ready to go, it's just not configured in php.ini.

  1. The output of phpinfo() doesn't include the ldap section
  2. Edit PHP.ini as administrator (see phpinfo() for full path... mine happens to be in C:\Program Files (x86)\iis express\PHP\v5.4\php.ini
  3. WPI puts the enabled modules at the bottom of the file. Add extension=php_ldap.dll
  4. phpinfo() immediately shows the ldap section.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.