[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: php ldap binding problems
Hi,
This is how I connect to LDAP and never had problems (my programming is
not professional, but anyway):
$ldap_server = "ldap://ldap.example.com";
$ldap_binddn = "uid=".$_POST['u'].",ou=people,dc=example,dc=com" ;
$ldap_pass = $_POST['p'];
$ldaphandle=ldap_connect($ldap_server);
if ($ldaphandle==FALSE) {
$message="Could not connect to server";
}
if (ldap_set_option($ldaphandle, LDAP_OPT_PROTOCOL_VERSION,
3)==FALSE){
$message="Could not set correct protocol version";
}
if (ldap_bind($ldaphandle, $ldap_binddn, $ldap_pass)==FALSE){
$message="Login error";
}
It always worked without problems. Note, however, that I always connect
to localhost, so I have no experience with remote connections.
It is important to force protocol version 3.
Nick
Has anyone had to problem using php_ldap where the bind to ldap will
work find but will unbind right away so any attempt to search the tree
fails?