ldap_add problems
| From: | Joseph Hoot | Date: | Fri, 06 Oct 2000 22:29:19 +0000 |
| Subject: | ldap_add problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18981@lists.php.net to get a copy of this message | ||
I tried using ldap_add() as per the documentation on php.net. Here is the code that I'm
getting errors in the ldap_add line:
<?php
$connection=ldap_connect("ldap.nowcomwan.com");
if ($connection) {
$bind=ldap_bind($connection,"cn=manager,dc=nowcom,dc=com","secret");
// prepare data
$info["cn"]="John Jones";
$info["sn"]="Jones";
$info["mail"]="Jones@test.com";
$info["objectclass"]="person";
// add data to directory
// the quick_reference on php.net suggests doing this as the example, however it
doesn't
// seem correct to have ldap_add being set to $r.. I tried both ways and get the same result
// $r=ldap_add($ds, "cn=John Jones, o=My Company, c=US", $info);
$add_entry=ldap_add($connection, "cn=John Jones,dc=nowcom,dc=com", $info);
ldap_close($connection);
} else {
echo "Unable to connect to LDAP Server";
}
?>
I had a much more robust $info before I tried this very simple one and every time I get
Warning: LDAP: add operation could not be completed. in
/home/httpd/html/ldapadmin/scripts/adduser.scp.php on line 14
I know that my ldap server is working fine. I am using openldap 2.0.4 and have configured the ldap
database correctly.. does anyone see anything wrong with the above script?