The means justifies the ends
$ad=ldap_connect("LDAP サーバーのアドレス");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
$bd = @ldap_bind($ad,'uid='.$username.",cn=users,dc=foo,dc=bar,dc=example,dc=co,dc=jp",$password);
ldap_unbind($ad);
if (!$bd) {
ログイン失敗
}
つまり、Bindするときに、DNを
uid=ログイン名,cn=users,dc=xxxx,dc=yyyy....
と指定するのが正解。