How to create a user with POSIX login ability in OpenLDAP via PHP?
<p>The following method is used to create a user with <strong>POSIX</strong> login ability in the OpenLDAP database. Users having the account created by the following method can login any of the OpenLDAP client linux machine. When calling this method, I have to pass the following variables:</p>

<ul>
<li><code>$ldapconn</code> : Returned by <code>ldap_connect</code>.</li>
<li><code>$username</code> : The username that I want to create.</li>
<li><code>$password</code> : The password for logging in the account.</li>
</ul>

<hr>

<pre><code>    public static function createNewUser($ldapconn, $username, $password) {
        if (!$ldapconn) { return false; }
        require_once("LDAPConfigurator.php");
        $r = ldap_bind($ldapconn, "cn=admin,dc=test,dc=com", "12345");

        // Prepare data
        $info = [
            'cn'            =&gt; $username,
            'sn'            =&gt; $username,
            'gidNumber'     =&gt; 502,
            'homedirectory' =&gt; "/home/ldap/".$username,
            'loginShell'    =&gt; "/bin/sh",
            'password'      =&gt; $password,
            'uidNumber'     =&gt; 2333, // Can I set auto increment for this value?
            'username'      =&gt; $username,
            'objectclass'   =&gt; [
                'inetOrgPerson',
                'posixAccount',
                'top'
            ]
        ];

        // Add data to directory
        $r = ldap_add($ldapconn, "cn=".$username",cn=users,ou=groups,dc=test,dc=com", $info);

        return true;
    }
</code></pre>

<hr>

<p>For setting the <code>$info</code> object, I reference the attributes used in a POSIX user account in <strong>phpLDAPadmin</strong> and they all have the <code>required</code> label. However, I finally get the following error:</p>

<pre><code>Warning: ldap_add(): Add: Undefined attribute type 
</code></pre>

<p>So what is the proper <code>$info</code> object for creating a POSIX user?</p>