Unable to enable PHP LDAP even though I have edited php.ini and php_ldap.dll is in the right place?

73,607

Solution 1

There are a few hints here: http://php.net/manual/en/ldap.installation.php . Note you need to add two other DLLs libeay32.dll and ssleay32.dll. You may also need to compile with --with-ldap

Solution 2

I followed these instructions but still couldn't get LDAP loading in my phpinfo(). The Apache logs showed on startup the following non-fatal message: ######/php5.4.16/ext/php_ldap.dll - The specified module could not be found. in Unknown on line 0

In the end, I looked at phpinfo() again and saw that the system variable PATH was being used instead of my user variable PATH and it didn't contain the correct path to PHP's root and PHP's extension folder. Simply adding them in ####\php\php5.4.16;####\php\php5.4.16\ext; and restarting Apache, solved the problem. Hope this can help someone else out.

Share:
73,607

Related videos on Youtube

Ciaran Phillips
Author by

Ciaran Phillips

Updated on February 28, 2020

Comments

  • Ciaran Phillips
    Ciaran Phillips about 4 years

    I've been working with a WAMP install for quite a while now with LDAP enabled and everything is going smoothly. Now though I have to set up another machine and for some reason I can't enable LDAP.

    I checked the output of phpinfo() and the LDAP section isn't there. I edited php.ini to uncomment the line:

    extension = php_ldap.dll
    

    I also checked the filepath being searched for extensions and the file php_ldap.dll is in the right place.

    I'm positive I'm editing the right php.ini file since I checked the filepath being shown by phpinfo(), and also I am able to successfully enable/disable other extensions.

    I have rebooted Apache after every change made.

    While Googling this, the only solutions I found were those above, plus one or two mentions of editing the Windows PATH variable to include the path to php.ini? Tried it even though it didn't make sense to me (as I already know php.ini is being parsed). I also checked my previous install on the other machine and from what I can see I never added any PHP directories to the PATH on that machine

    Edit with complete answer

    Frank's answer below led me to the solution so I thought I'd consolidate everything now.

    To Enable LDAP Support on a WAMP server:

    1. Uncomment extension = php_ldap.dll in php.ini
    2. IMPORTANT: Make sure that you're editing the right php.ini by checking the output of phpinfo()
    3. Check the php.ini file for the location of your extensions directory
    4. Check that php_ldap.dll is located in that directory
    5. (THE STEP I MISSED) Find the files libeay32.dll and ssleay32.dll and add their directory to the Windows PATH
    6. Reboot Apache. If LDAP is enabled there will be a section about it in the output of phpinfo()
    • Frank Farmer
      Frank Farmer over 12 years
      There are a few hints here: php.net/manual/en/ldap.installation.php . Note you need to add two other DLLs libeay32.dll and ssleay32.dll. You may also need to compile with --with-ldap
    • Ciaran Phillips
      Ciaran Phillips over 12 years
      Hm... I don't have access to the machine now but I have a feeling that's what I needed. I mentioned above I added the php.ini directory to PATH, perhaps I was misread something saying to add the extensions directory to the PATH. I possibly copied the two .dll files straight into system32 last time I set this up, so I wouldn't have found any clues when I checked that machine's PATH
    • Ciaran Phillips
      Ciaran Phillips over 12 years
      @FrankFarmer it's working now! Those two files were sitting in the same directory that php.ini was in but obviously weren't being found. I added that directory to the windows PATH and LDAP became enabled! I checked the first machine again (the one that was working) after that for those files, they were in PHP's default extension folder. So maybe copying them in there is all that's needed, rather than using the PATH variable. I didn't think to check at the time, but tomorrow morning I'll move those files and reboot. Then I'll post back here again just to have everything covered.
    • Ciaran Phillips
      Ciaran Phillips over 12 years
      @FrankFarmer Your comment led directly to the solution, so if you'd like to post an answer I'll accept it
    • Makarand Mane
      Makarand Mane about 10 years
      when I saw php.ini file this (extension = php_ldap.dll) was not there I just added this line and ldap enabled.