2

I have Apache 2.4 and php installed on Windows Server 2012.

Im trying to load the php_ldap.dll extension.

Here's what Ive done:

In php.ini I set the following:

extension_dir = "C:\php\ext"

extension=php_ldap.dll

Then, I made sure the dll was available at that path, yep, it's there:

enter image description here

phpinfo shows that I am editing the correct php.ini and the extension_dir is updated.

However, when I start Apache, php_ldap.dll is not loaded.

The Apache logs show this warning:

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\\php\\ext\\php_ldap.dll' - The specified module could not be found.\r\n in Unknown on line 0

How can I fix this?

Also, what's with the \\? Why is it doubling the "\" and is that the problem?

Cyclonecode
  • 29,115
  • 11
  • 72
  • 93
Wesley Smith
  • 19,401
  • 22
  • 85
  • 133
  • 1
    double \\ is for escaping the first \ and no it is not the problem – Yehia Awad Jul 17 '16 at 01:08
  • I am not sure if that is the issue but try replacing extension_dir = "C:\php\ext" with extension_dir = "C:\php\ext\" – Yehia Awad Jul 17 '16 at 01:15
  • 1
    Notice that the ldap extension also needs the following two libraries `libeay32.dll` and `ssleay32.dll`. You need to make sure so these two libraries are in your `PATH`, for example under `C:\Windows\System32`. http://php.net/manual/en/ldap.installation.php – Cyclonecode Jul 17 '16 at 01:15
  • http://stackoverflow.com/questions/12348/php-curl-on-windows-install-the-specified-module-could-not-be-found also have a look if here it might lead you somewhere – Yehia Awad Jul 17 '16 at 01:20

2 Answers2

3

My best guess would be that a needed library is missing from your system. The php_ldap extensions requires that both libeay32.dll and ssleay32.dll is installed on the system:

From the ldap installation manual:

Note: Note to Win32 Users

In order for this extension to work, there are DLL files that must be available to the Windows system PATH. For information on how to do this, see the FAQ entitled "How do I add my PHP directory to the PATH on Windows". Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the system's PATH), this is not recommended. This extension requires the following files to be in the PATH: libeay32.dll and ssleay32.dll Versions before PHP 4.3.0 additionally require libsasl.dll.

Community
  • 1
  • 1
Cyclonecode
  • 29,115
  • 11
  • 72
  • 93
0

Do not use backslash in the php.ini !

Always slash in the php.ini even on Windows system.

extension_dir = "C:/php/ext"

extension=php_ldap.dll
Florent
  • 436
  • 3
  • 8
  • While this may be good advice, its probably better suited as a comment than an answer since it doesn’t actually address the problem – Wesley Smith Feb 12 '19 at 20:14
  • i had the same extension problem on my windows system. extension_dir = "C:/phpintalldir/ext" vas the key. – Florent Feb 13 '19 at 08:52