I am trying to enable LDAP for my PHP installation and when I enable the extension=php_ldap.dll line in my php.ini file and restart Apache, I get the following. This is PHP 5.2 on Win Xp. Thanks.

PHP Warning: PHP Startup: ldap: Unable to initialize module\nModule compiled with module API=20050922, debug=0, thread-safety=1\nPHP compiled with module API=20060613, debug=0, thread-safety=1\nThese options need to match\n in Unknown on line 0

    This seems to be a common problem but I have yet to find the solution. I have my path variable set, the file php_ldap.dll is in the C:\PHP\extensions\ directory, and all the other modules that I have enabled load from that directory.

    Any ideas?? I am at a loss.

      yes

      Remove the added "\" in the config file. For some reason if you install PHP using the default installer, it configures your http.conf and php.ini with those added \ instead of just \

        I tried removing the extra slash with no luck. There are other mysql modules being loaded from the extensions directory without a problem. It is just this one that will not load.

          Did you add your PHP directory to your system's PATH environment variable? What version of PHP are you using? Do you see a bunch of .dll files (such as libeay32.dll, libmysql.dll, etc.) in the root of the PHP folder?

            I tried uncommenting another extension in my PHP.ini file and it too does not load so I have a configuration issue. Here is my setup:

            PHP 5.2.3 installed in c:\php

            Path=C:\PHP;C:\svn-win32-1.4.3;C:\Program Files\ActiveState Komodo IDE 4.0\;C:\Program Files\Oracle\instantclient;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Python22;C:\Program Files\MySQL\MySQL Server 5.0\bin

            extension_dir=C:\PHP\extensions

            All of the dll's are in C:\PHP\extensions

            Is this a bug. I have not had this problem in the past.

              Have you tried commenting out all other extensions and only trying to load php_ldap.dll (or another one that refuses to load) ?

              Does Apache's error log have any useful information?

              Have you tried rebooting?

              EDIT: I just noticed your other thread concerning the same issue and have merged them together. This error sounds like either the support library or the extension DLL don't match up. I would recommend re-downloading PHP (you can save your php.ini file and whatnot, but you need to overwrite all of the DLL's).

                Thank you for merging the posts. I tried to delete the other one. The other post related to 5.2.1 which is why I downloaded 5.2.3 and did a fresh install. I no longer have the incompatible API issue, it just will not load the library.

                This is what apache tells me:

                [Sat Aug 18 12:32:36 2007] [notice] Parent: Received restart signal -- Restarting the server.
                [Sat Aug 18 12:32:36 2007] [notice] Child 3876: Exit event signaled. Child process is ending.
                [Sat Aug 18 12:32:36 2007] [notice] Apache/2.0.59 (Win32) PHP/5.2.3 configured -- resuming normal operations
                [Sat Aug 18 12:32:36 2007] [notice] Server built: Jul 27 2006 15:55:03
                [Sat Aug 18 12:32:36 2007] [notice] Parent: Created child process 3612
                PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\extensions\php_ldap.dll' - The specified module could not be found.\r\n in Unknown on line 0
                PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP\extensions\php_soap.dll' - The specified procedure could not be found.\r\n in Unknown on line 0
                [Sat Aug 18 12:32:36 2007] [notice] Child 3612: Child process is running
                [Sat Aug 18 12:32:37 2007] [notice] Child 3876: Released the start mutex
                [Sat Aug 18 12:32:37 2007] [notice] Child 3612: Acquired the start mutex.
                [Sat Aug 18 12:32:37 2007] [notice] Child 3612: Starting 250 worker threads.
                [Sat Aug 18 12:32:38 2007] [notice] Child 3876: Waiting for 250 worker threads to exit.
                [Sat Aug 18 12:32:41 2007] [notice] Child 3876: All worker threads have exited.
                [Sat Aug 18 12:32:41 2007] [notice] Child 3876: Child process is exiting

                Two extensions that do load are:

                extension=php_mysql.dll
                extension=php_mysqli.dll
                extension=php_oci8.dll

                I think the 'cannot be found' error is misleading in some way. The dll's are in the directory and PHP knows where to look, since it is loading other extensions from that directory. I'm not sure what is different about the ldap and soap extensions.

                  j_70 wrote:

                  All of the dll's are in C:\PHP\extensions

                  What do you mean by "all" ? The only DLL's that should be in that directory are ones that begin with "php_". If there are other DLL's in there, they are in the wrong place.

                  In c:\php\ you should have several DLLs such as libeay32.dll, ssleay32.dll, libmysql.dll, etc. etc. Do you have these?

                  Also, try changing the slashes to forward slashes in your php.ini file (e.g. "c:/php/extensions"). Also, are you positive the directory is called 'extensions' and not 'ext' ?

                    What do you mean by "all" ? The only DLL's that should be in that directory are ones that begin with "php_". If there are other DLL's in there, they are in the wrong place.

                    That is what I meant. Basically all the extensions that come with PHP and a few mysql I have added.

                    In c:\php\ you should have several DLLs such as libeay32.dll, ssleay32.dll, libmysql.dll, etc. etc. Do you have these?

                    No, the only ones I have are:

                    php5apache2.dll
                    php5apache2_filter.dll
                    php5apache_hooks.dll
                    php5ts.dll

                    Also, try changing the slashes to forward slashes in your php.ini file (e.g. "c:/php/extensions"). Also, are you positive the directory is called 'extensions' and not 'ext' ?

                    I am pretty sure that Apache knows where the right directory is. To test this I have the php_mysqli extension uncommented out in the php.ini file and if I remove the dll from the c:\php\extensions directory, I get the following on restart:

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

                    When I put the php_mysqli.dll back in the c:\php\extensions directory and restart apache, that error disappears but the others remain:

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

                    I have gotten LDAP to work in LINUX, but it is necessary to recompile the binary with LDAP support. This is my first try in Windows and there is nothing in the doco that says you have to build from source in Windows to get this to work.

                      If you don't have the DLLs in your c:\php\ folder, then you're missing them - this will prevent several extensions from loading. Do you have a "dlls" folder?

                        Something must have gone wrong during the install. For some reason, some of the dll's did not get put in the c:\php directory. I downloaded the zip file as opposed to the .msi installer and manually copied the dll's to the c:\php folder. Ldap loads now. Thanks.

                          No problem.

                          This is why I always recommend using the zipped package - I've never trusted the MSI installer.

                            Write a Reply...