Re: Please help me!!! php ldap_add error Object class violation
| From: | Gabor Hojtsy | Date: | Sun, 12 Jan 2003 17:04:12 +0000 |
| Subject: | Re: Please help me!!! php ldap_add error Object class violation | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-14979@lists.php.net to get a copy of this message | ||
Please see http://php.net/support for a list of appopriate
places to
ask support questions.
Goba [one webmaster@php.net]
----- Original Message -----
From: "Kitti Boonmee" <kitti.b@asianet.co.th>
To: <webmaster@php.net>
Sent: Saturday, January 11, 2003 4:49 PM
Subject: Please help me!!! php ldap_add error Object class violation
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";
}
?>