I am trying to connect to LDAP with php-ldap. I have a problem with ldap_bind() :
$username = 'josue.ruiz'; $password = 'pass'; $ldapconfig['host'] = '10.10.10.11'; $ldapconfig['port'] = 389; $ldapconfig['basedn'] = 'dc=domain,dc=com'; $ds=ldap_connect($ldapconfig['host'], $ldapconfig['port']); ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); $dn="cn=".$username.",ou=Technology,".$ldapconfig['basedn']; if ($bind=ldap_bind($ds, $dn, $password)) { echo("Login correct"); } else { echo("Login incorrect"); }
I get this message:
Warning: ldap_bind (): cannot bind to server: invalid credentials in ...
But when I try like this:
ldap_bind($ds,' josue.ruiz@domain.com ','pass');
It works fine, but it doesnโt work for me, because I want to filter OU , and I cannot do this. Does anyone have any tips on this issue?
source share