I'v installed Openldap in Ubuntu 14.04 and i'v also installed phpldapadmin everything looks fine until this step , but when i try to connect my php application with this script i have the same response as a result resource id #2
this is my script :
$ds=ldap_connect("ladp://192.168.1.2",389)or die("Could not connect to $ldaphost");
echo 'Le résultat de connexion est ' . $ds . '<br />';
if ($ds) {
echo 'Liaison ...';
$username = "cn=admin,dc=ldap,dc=com";
$upasswd = "password";
$r=ldap_bind($ds,$username, $upasswd);
echo 'Le résultat de connexion est ' . $r . '<br />';
If you are using LDAP 2
When OpenLDAP 2.xx is used, ldap_connect() will always return a resource as it does not actually connect but just initializes the connecting parameters. The actual connect happens with the next calls to ldap_* funcs, usually with ldap_bind().
I think you might need to test the result of the ldap_bind()
like this suggestion in the manual
<?php
$ds=ldap_connect("ldap://192.168.1.2",389)or die("Could not connect to $ldaphost");
$username = "cn=admin,dc=ldap,dc=com";
$upasswd = "password";
$r=ldap_bind($ds,$username, $upasswd);
// verify binding
if ($r) {
echo 'Le résultat de connexion est ' . $r . '<br />';
} else {
echo "LDAP bind failed...\n";
echo ldap_error($ds);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.