PHP and OS X's OpenLDAP
Wed Jul 04, 2007 · 166 words

After spending nearly a full day figuring out how to make PHP (5.2.x) authenticate to OS X Server's (10.4.9) OpenLDAP, I decided to put down the results:

So the solution was to just search for the full DN without a anonymous bind:

$result = ldap_search ($ds, $myBaseDn, "uid=$username", array ("cn"));
$info = ldap_get_entries ($ds, $result);
$userDn = $info[0]['dn'];

… and then try to authenticate:

$r = ldap_bind ($ds, $userDn, $password);

No changes on the server side are required, AFAIK.

Some other random notes on troubleshooting LDAP:

… to syslog.conf


back · essays · credits ·