My Env is as follows:
Windows Server 2003 Sp2
PHP 5.2.3
Apache 2.0.x

My LDAP test page is:

<?php
$ldapconn =ldap_connect("ldap.test.com", 389);
if($ldapconn){
echo "Success ";
}
else{
echo "Fail";
}
?>

When I web browse to that file I get the following error:
Fatal error: Call to undefined function ldap_connect()

From command line I can execute that PHP file and get the following:
Success

I check the apache log file and I find

PHP Warning: PHP Startup: Unable to load dynamic library '%PHPRC%\ext\php_ldap.dll' - The operating system cannot run %1.\r\n in Unknown on line 0

I have copied the ssleay32.dll and libeay32.dll into the path.
I'm thinking that it is the Apache php5apache2.dll module that is failing but I don't know how to fix it.

Any ideas?

    19 days later

    I had a little help with this from a collegue. We resolved this by isolating the Apache server.

    The problem was that Apache was loading a different ssl module which was using a different ssleay32.dll and libeay32.dll then when apache tried to load the php_module which in turn tried to load php_ldap.dll it crashed because that resource was already loaded and in use.

    So the fix was to create a second apache directory and run a second apache process which loads php separate from the other apache process which loaded the other ssl libraries.

      Write a Reply...