Add: Object class violation

Hello all,

I try this PHP code in order to insert some entry into OpenLDAP, but I have the error you can see in the title.

Here is the code:

PHP:
<?php

$dn = "cn=Luis diaz, ou=People, dc=isciii, dc=es";

$info["cn"] = "usuario nuevo";
$info["objectClass"] = "organizationalPerson";
$info["objectClass"] = "posixAccount";
$info["sn"] = "usuario";
$info["uid"] = "unuevo";
$info["uidNumber"] = 501;
$info["gidNumber"] = 501;
$info["ou"] = "PRUEBA";
$info["loginshell"] = "/bin/bash";

$host = "localhost";
$ldapconn = ldap_connect($host);
$bindresult = ldap_bind($ldapconn, "cn=Administrador,dc=isciii,dc=es", "xxxx");

if (!(ldap_add($ldapconn, $dn, $info))){
    echo "Failed to add user: " . ldap_err2str(ldap_errno($ldapconn));
    return false;

} else {

    return true;

}
?>

and here is the error:

Code:
php test.php
PHP Warning:  ldap_add(): Add: Object class violation in /usr/share/koha/intranet/htdocs/admin/lib/test.php on line 19
Failed to add user: Object class violation[root@s17pre lib]# vi test.php

What is the way to get more detail with the error? I see in OpenLDAP documentation that there are a lot of different errors related to object class violation.

Does anyone know?

Thanks in advance
 
Back
Top