Hi All, I just thought people should realize that the bug, or whatever change that was implemented with slapd and Openldap for the version V3 protocol has either not been repaired, or isn;t believed to be a bug or whatever...but still requires an implicit setting to V3 for use of the ldap_bind function. I am using Apache 2 and PHP 5.1 with LDAP 2. The default is set to deny V2 protocol, and even reconfiguring the slapd config file will not fix the problem.
You must still use the ldap_set_option function.
EX:
<?php
$ldapHost = "ldap://server";
$ldapPort = "port";
$ldapUser ="cn=name,dc=domain";
$ldapPswd ="password";
$ldapLink =ldap_connect($ldapHost, $ldapPort)
or die("Can't establish LDAP connection");
if (ldap_set_option($ldapLink,LDAP_OPT_PROTOCOL_VERSION,3))
{
echo "Using LDAP v3";
}else{
echo "Failed to set version to protocol 3";
}
ldap_bind($ldapLink,$ldapUser,$ldapPswd)
or die("Can't bind to server.");
?>
Thanks to Ken on below for showing the way. There was a slight code error in what he chose as his link_id, but thats all. This code above worked nice and shinny, and demonstrates we are still working with 2004 problems. I wish they would update this in the code above.