I've just built a clean Redhat 7.1 server with the stock Apache/PHP/MySQL/OpenLDAP. I'm trying to get my PHP to talk to our Exchange Server - and it doesn't work. It seems I can connect/bind okay, but the search fails.
When I tried using ldapsearch(1) to prove that my server could talk to the Exchange server I discovered that I need to specify the -x (disable SASL authentication) option.
My question is: how do I do the same thing via PHP? Here's the code I've been using:
$linkid = ldap_connect("ldap://flowers.aethos.co.uk/");
if (!$linkid) {
echo "ldap_connect() failed<br>";
}
else {
echo "ldap_connect() OK<br>";
}
if (!ldap_bind($linkid)) {
echo "ldap_bind() failed<br>";
}
else {
echo "ldap_bind() OK<br>";
}
$lres = ldap_search($linkid, "", "(sn=green)", array("sn", "dn"));
if ($lres) {
echo "No of entries found: " . ldap_count_entries($linkid, $lres) . "<br>";
}
else {
echo "ldap_search() failed<br>";
}
ldap_close($linkid);
The script output looks like this:
ldap_connect() OK
ldap_bind() OK
Warning: LDAP: Unable to perform the search: Protocol error in /var/www/html/licenses.php on line 39
ldap_search() failed
I expect its me being dumb, but I'm blowed if I can see where. Please help!
Thanks
-Bob