Reputation: 2056
I'm using WAMP and trying to run something like the following:
<?php
$ldap = ldap_connect("ldap.example.com");
$user = "exampleUser";
$pass = "examplePass";
if($bind = ldap_bind($ldap, $user, $pass)) {
// logged in
} else {
// error message
}
?>
Before doing this though, I tried running phpinfo() to see if ldap was installed, and it doesn't appear anywhere.
I've tried the following:
I don't really know what I'm doing, but these were the suggestions I found online. Any help would be appreciated!
Upvotes: 4
Views: 6905
Reputation: 1
it's very too late, but i had the problem and i wanted to add that you must uncomment extension=php_ldap.dll in both php and apache's php.ini.
Upvotes: 0
Reputation: 12358
This answer may be useful for others who come across this question as it's over a year since the OP posted this question.
I'm running
I tried most suggested solutions that a Google search will bring you to and nothing seemed to work. A forum recommended looking at the PHP pages
A user by the name of Frank in the above link recommended to copy libsasl.dll
to [apache folder]\bin
despite this only being recommended for earlier versions of php, this file is in the php folder.
copy "C:\wamp\bin\php\php5.4.16\libsasl.dll" "C:\wamp\bin\apache\apache2.4.4\bin\libsasl.dll"
This is what worked for me and LDAP is now showing up when I use phpinfo()
, although I haven't properly tested it yet besides running the ldap_connect()
function, but I'm assuming that means it is working and I should be able to use it in my application.
Besides adding libsasl.dll
to the Apache bin I added C:\wamp\bin\apache\Apache2.4.4\bin
and C:\wamp\bin\php\php5.4.16
to my PATH
(i.e. the Windows environment variables -> system variables -> path) and I added ssleay32.dll
and libeay32.dll
to the both the Apache and php bin, not sure if required but it's working now.
Upvotes: 6
Reputation: 393
I resolved the same problem by adding the php
folder in the following Windows system path:
at command prompt
SET PATH=C:\wamp\bin\php\php5.3.13;%PATH%
Upvotes: 0
Reputation: 3895
I simply copied 'libsasl.dll' from the php directory to the apache directory and obviously restarted httpd. This solved my problem.
This was not a WAMP installation, I installed apache and php separately. Perhaps in case of WAMP or LAMP some more files can be needed.
Upvotes: 0
Reputation: 14237
What errors do you get? function does not exist?
Also you should add the following lines after your ldap_connect function:
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_DEBUG_LEVEL, 7);
if(!$ldap){
echo "LDAP Failed To Connect: ".ldap_error($ldap);
}
The options set ldap to protocol version 3, which is needed for active directory and alike on server 2k3 and alike and enabled debugging on the ldap connection.
Update
Also, run phpinfo() and look for the extensions directory. Navigate to that directory and make sure that php_ldap.dll exists in there.
Upvotes: 0