divya shree wrote:
hii we r trying to write a php script to bind to the ldap server.. the php script is
<?php // basic sequence with LDAP is connect, bind, search, interpret search // result, close connection echo "LDAP query test"; echo "Connecting ..."; $ds=ldap_connect("localhost"); // must be a valid LDAP server! echo "connect result is " . $ds ; if ($ds) { echo "Binding ..."; $r=ldap_bind($ds); // this is an "anonymous" bind, typically // read-only access echo "Bind result is " . $r ; } ?>
we also tried doin $ldapset=ldap_set_option($ldapconn,LDAP_OPT_PROTOCOL_VERSION,3); and $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
where Ldaprdn= rootdn in the slapd.conf file and ldappass is the password
we r getting the following error in all the above cases
LDAP query test Connecting ... connect result is Resource id #4 Binding ...PHP Warning: ldap_bind(): Unable to bind to server: Protocol error in /var/www/html/forms/ex1.php on line 12
plz help ASAP Thanks and Regards Divya
Hello,
In your first code snippet mentions $ds as your "ressource link identifier" (cf. http://fr.php.net/manual/en/function.ldap-bind.php). In your second attempt (when you try to set ldap_v3), you are setting options and binding on a connection that does not exist ($ds vs $ldapconn).
Cheers, Olivier