Reputation: 83
I try to connect to LDAP in PHP with this code :
$ds = ldap_connect("122.134.124.2", 389);
$login = "[email protected]";
$password = "password";
if ($ds)
{
$r = ldap_bind($ds, $login, $password);
$sr = ldap_search($ds, "dc=domain,dc=local", "cn=m*");
}
else
echo "Impossible to connect to the LDAP server.";
And I get this error : ldap_search(): Search: Operations error in test.php on line 8 (the line with the ldap_search function).
Yet the connection works and I put all the parameters of the function ldap_search.
Upvotes: 2
Views: 7028
Reputation: 83
The solution was to add these lines to the code : ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
Upvotes: 2