[Date Prev][Date Next] [Chronological] [Thread] [Top]

LDAP ssl over PHP




I have a problem when i use php to bind my ldap directory over ssl

If i use on shell command
ldapsearch -x -H 'ldaps://localhost/' -b 'uid=100000, ou=company, dc=domain, dc=com' -D 'uid=100000, ou=company, dc=mydomain, dc=com' -W
I have good result



My script is like that :

$server = "ldap://localhost"; ;
$ds=ldap_connect($server);
$dn = "uid=100000, ou=company, dc=domain, dc=com";
$value = "password";

$result=@ldap_bind($ds,$dn,$value);
$dn = "ou=company, dc=domain, dc=com";
$filtre = "(cn=*DUPONT*)";
$sr = ldap_search($ds, $dn, $filtre);
$info = ldap_get_entries($ds, $sr);

for ($i=0; $i < $info["count"]; $i++) {
     print "UID: ".$info[$i]["urn"][0]."<br /><br />";
}

ldap_close($ds);



i have a result, but if i change $server = "ldap://localhost"; by "ldaps://localhost) i have a error message "Can't contact LDAP server"

Thanks for your help