I'm trying to connect to LDAP that uses simple bind through PHP 7.2.
I used LDAP Admin desktop app to check my settings and everything works. The app uses my sAMAccountName in form of name.surname
and password to log me in. I would like to achieve the same thing through PHP but the only way I managed to get a successful login was below:
$ldap_user = "CN=Name Surname,OU=Users,OU=Sample,DC=sample,DC=othersample";
$ldap_pass = "myPassword";
$c = ldap_connect("ldap://x.x.x.x", 389);
ldap_set_option($c, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($c, LDAP_ESCAPE_DN, 1);
ldap_bind($c, $ldap_user, $ldap_pass);
However, my goal is to have $ldap_user
to be just the name.surname
, the same way the app uses it.
Is there a way to achieve that?