By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,064 Members | 1,445 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,064 IT Pros & Developers. It's quick & easy.

Problem LDAP and Win2003 AD

P: n/a
I'm trying simple scripts to browse an Active Directory via LDAP
My domain is: schoollm.lan

The script I'm trying:

$root_dn = "ad***********@mascheroni.lan";
$root_pw = "secret";

$conn = ldap_connect("") or die("Could not connect to

ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);

$r = ldap_bind($conn, $root_dn, $root_pw) or die("Could not bind to

$result = ldap_search($conn,"dc=schoollm, dc=lan","(cn=*)") or die
("Error in search query");

$info = ldap_get_entries($conn, $result);

for ($i=0; $i<$info["count"]; $i++)
echo "dn is: ". $info[$i]["dn"] ."<br>";
echo "first cn is: ". $info[$i]["cn"][0] ."<br>";
echo "first email address is: ". $info[$i]["mail"][0] ."<p>"; }

echo "Number of entries found: " . ldap_count_entries($conn, $result)


I always get this error:

Warning: ldap_search(): Search: Operations error in
C:\Programmi\Apache Group\Apache2\htdocs\ldap.php on line 12
Error in search query

Where I'm wrong?
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.