Problem in creating LDAP user through php script
<p><strong>1.</strong> I have created user in LDAP using php script under pre defined "ou" but unable to create "ou" or "cn" through my script.
<strong>2.</strong></p>

<pre><code>// configure privileged user

$root_dn = "cn=test,dc=design,dc=com";

$root_pw = "your password"; 

// specify the LDAP server to connect to

$conn = ldap_connect("localhost") or 
die("Could not connect to server. Error is " . ldap_error($conn)); 

// bind to the LDAP server 

$r = ldap_bind($conn, $root_dn, $root_pw) or
 die("Could not bind to server.Error is " . ldap_error($conn));

// prepare data

$info["cn"] = $_POST['cn'];

$info["sn"] = $_POST['sn'];

$info["mail"] = $_POST['mail'];

$info["userPassword"] = "testPWD";

$info["objectClass"] = "inetOrgPerson";


// prepare DN for new entry
$dn = "mail=" . $_POST['mail'] .",ou=Groups,domainName=your domaun name,o=domains,
dc=dc, dc=com";

// add data to directory

$result = ldap_add($conn, $dn, $info);

// if successful, display success message

if($result) 

{
echo "New entry with DN " . $dn . " added to LDAP directory."; } 
// elsedisplay error 
else 
{
echo "An error occurred. Error number " . ldap_errno($conn) . ": " .ldap_err2str(ldap_errno($conn)); }

// all done? clean up

ldap_close($conn);
</code></pre>

<p><strong>Issue:</strong> 
After creating user successfully, I am unable to log in for viewing mail by using "mail" and "password".Though I can see new created user in "LDAP" directory list.
When I checked there was no option was enable under "enabledService" may be this is the problem...please suggest...and if yes then how to create full privileged user through php script.</p>

<p>Thanks in Advance!</p>
