使用PHP和LDAP在搜索查询中出错

I am binding to the LDAP server anonymously. I want to run a search in the AD. The problem is that this returns an error on the query search.

// LDAP variables
$ldaphost = "ldap://#.#.#.#";  // ldap servers
$ldapport = ###;              // ldap server's port number

ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);

// Connecting to LDAP
$ldapconn = ldap_connect($ldaphost, $ldapport)
      or die("Could not connect to $ldaphost");

if ($ldapconn) {

    // binding anonymously
    $ldapbind = ldap_bind($ldapconn);

    if ($ldapbind) {
        echo "LDAP bind anonymous successful...";
    } else {
        echo "LDAP bind anonymous failed...";
     }

}




$dn = "OU=group,DC=base,DC=base1,DC=base2,DC=base3";
$filter =  "(objectClass=*)";


echo ldap_error($ldapconn);

ldap_search($ldapconn, $dn, $filter) or die("error in search query");

Results: LDAP bind anonymous successful... Success error in search query

Any ideas why this is happening?