I am using LDAP (this is actually my first project) and I can’t find a google answer that can help me ... Therefore my problem: I am trying to add a contact with php to the active directory on a Windows 2003 server. I can connect to the server, and I have no problem with ldap_bind. But when I run the program, I always get an error message:
Warning: ldap_add () [function.ldap-add]: Add: Operational error in (Blabla) in bla string
and ldap_error also says only “Operation Error”, which is rather vague, so I don’t even know if there is a problem with the server or with my code. I saw some threads with similar problems when the servers did not allow anonymous access, but I even contact the administrator account and still does not work.
My code looks something like this:
$ldapcon=ldap_connect("servername");
if($ldapcon) {
$bind=ldap_bind($ldapcon,"Admin@domain.com", "somePassword");
if($bind) {
$info=array();
$info["cn"][0] = "Hans Mustermann";
$info["sn"][0] = "Mustermann";
$info["givenName"][0] = "Hans";
$info["mail"][0] = "MustermannH@firma.de";
$info["objectclass"][0] = "top";
$info["objectclass"][1] = "person";
$info["objectclass"][2] = "organizationalPerson";
$info["objectclass"][3] = "contact";
$info["ou"][0] = "Users";
$info["ou"][1] = "contact";
$r=ldap_add($ldapcon, "cn=Hans Mustermann, sn=Mustermann", $info)
or die(ldap_error($ldapcon));
}
}
Is there any information? Is the code incorrect? Do I need some changes to my ad settings? is it a problem with "setting up remote rights" or something else? Am I just too stupid and blind to see the problem, or is this a big thing that is not easy to fix? Do any of you have an idea?
Thanks a lot Chillikarli
source
share