Please help me!!! php ldap_add error Object class violation
| From: | Kitti Boonmee | Date: | Sat, 11 Jan 2003 15:49:54 +0000 |
| Subject: | Please help me!!! php ldap_add error Object class violation | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-14970@lists.php.net to get a copy of this message | ||
Dear all,
I write code below.I have problem show error is
Warning: ldap_add(): Add: Object class violation in /home/flow/qadmin/ladd.php on line 18
Error:Object class violation
But I test command ldapadd on linux system can add data.
Please investigate problem.
Spec:
Apache 2.0.40
Php : 4.3.0
Ldap : Openldap 1.130 2002/11/05
thank you.
kitti
------------------------------------------------------------------------------------------------------------
$ds=ldap_connect("127.0.0.1"); // assuming the LDAP server is on this host
if ($ds) {
// bind with appropriate dn to give update access
$r=ldap_bind($ds,"cn=Manager,dc=myldap, dc=co.th", "test123");
// prepare data
$info["objectClass"][]="top";
$info["objectClass"][]="person";
$info["objectClass"][]="qmailuser";
$info["cn"]="test";
$info["sn"]="test";
$info["uid"]="test";
// add data to directory
$r=ldap_add($ds,"uid=test,ou=Users,dc=myldap,dc=co.th", $info);
$e=ldap_errno($ds);
echo "Error:".ldap_err2str($e)."<br>";
ldap_close($ds);
} else {
echo "Unable to connect to LDAP server";
}
?>