title: ldap_add(): Add: Object class violation error
body: <p>When I try to add attribute to the OpenDS via PHP I get the following error:</p>
  
  <blockquote>
    <p>ldap_add(): Add: Object class violation</p>
  </blockquote>
  
  <p>Please help.</p>
  
  <p>Here is my code </p>
  
  <pre><code>&lt;?php
  $ldapconfig['host'] = 'PC100';
  $ldapconfig['port'] = 1389;
  $ldapconfig['basedn'] = 'dc=company,dc=com';
  
  $ds=ldap_connect($ldapconfig['host'], $ldapconfig['port']);
  
  $password=1;
  $username="cn=Directory Manager";
  
  if ($bind=ldap_bind($ds, $username, $password)) {
    echo("Login correct");
    ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); // IMPORTANT
    $dn = "cn=roshan1,dc=example,dc=com"; 
    //$newuser["objectclass"] = "inetOrgPerson"; 
    //$newuser["cn"] = "new1"; 
    //$newuser["sn"] = "user"; 
  
    $ldaprecord['cn'] = "roshan1";
    $ldaprecord['givenName'] = "mkljl";
    $ldaprecord['sn'] = "roshan";
    $ldaprecord['objectclass'] = "inetOrgPerson";    
    $ldaprecord['mail'] = "lkl@fh.com";
    $ldaprecord['mmmm'] = "77878";
  
    // add data to directory
    $r = ldap_add($ds, $dn, $ldaprecord);
  
  } else {
  
    echo("Unable to bind to server.&lt;/br&gt;");
  
  }
  ?&gt;
  </code></pre>
  
  <p>If I remove <code>$ldaprecord['mmmm'] = "77878";</code> from the code it works fine. How can I add a new attribute like this?</p>