Hello all,
The following script returns 'search failed...' after 'LDAP bind
successful...'.
==
<?php
$ldaprdn = "CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu";
$ldappass = "passwd";
$ds=ldap_connect("ad.coll.some.edu");
if ($ds) {
echo "Binding ...<br />";
$r=ldap_bind($ds, $ldaprdn, $ldappass);
if ($r) {
echo "LDAP bind successful...<br />";
} else {
echo "LDAP bind failed...<br />";
exit;
}
$filter = "(sAMAccountName=jsmith)";
$base = "DC=Coll,DC=some,DC=edu";
$sr=ldap_search($ds, $base, $filter);
if ($sr)
{
echo "Search result is " . $sr . "<br />";
} else {
echo "search failed...<br />";
}
}
?>
==
However, the following ldapsearch returns the result fine.
% ldapsearch -h ad.coll.some.edu -s sub -b "dc=coll,dc=some,dc=edu" -x
-D 'CN=John Smith,OU=Users,DC=Coll,DC=some,DC=edu' -W
"samaccountname=jsmith"
I'm in dark now and don't know where to look for more information on why
ldap_search did not work. I'd appreciate any help.
Bing
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php