I figured it out so skip this post
unset($info['count']);
removed the part of the array that openldap was balking at. Everything works peachy now.
I'm trying to add to ldap for the first time with php and I'm having issues.
I've read and followed the documentation found at http://us2.php.net/ldap_add and have a similar structure.
[code=php]$info['objectclass'][0] = "couriermailalias";
$info['objectclass'][1] = "couriermailaccount";
$info['objectclass'][2] = "inetorgperson";
$info['structuralobjectclass'] = "intorgperson";
$info['subschemasubentry'] = "cn=subschema";
$info['uid'] = $userid;
$info['givenname'] = $firstname;
$info['sn'] = $lastname;
$info['cn'] = "$firstname $lastname";
$info['userpassword'] = "$password";
$info['homedirectory'] = "/var/spool/mail/$domain/$userid";
$info['mail'] = "$userid@$domain";//fix this
$info['maildrop'][0] = strtolower("$firstname.$lastname@$domain");
//$info['maildrop'][1] = strtolower("$emailaddresses");
$info['uidnumber'] = (int) 1003;
$info['gidnumber'] = (int) 1003;
$info['mailbox'] = "/var/spool/mail/$domain/$userid/Maildir";
$ldapadd = ldap_add($ldapconnect, "uid=$userid, ou=$domain, ou=people, dc=horvitznewspapers, dc=net", $info) or die("could not add to LDAP");[/code]
When I try to add I get an error that it failed. My ldap logs say this:
conn=23 op=2 ADD dn="uid=bryanir,ou=KCJ,ou=people,dc=horvitznewspapers,dc=net"
conn=23 op=2 RESULT tag=105 err=17 text=count: attribute type undefined
conn=23 op=3 UNBIND
conn=23 fd=12 closed
it's failing because count isn't in the schema anywhere. I beleive it's getting pulled from the array because when I do a var_dump on $info I get the following output:
array(15) {
["count"]=>
int(0)
["objectclass"]=>
array(3) {
[0]=>
string(16) "couriermailalias"
[1]=>
string(18) "couriermailaccount"
[2]=>
string(13) "inetorgperson"
}
["structuralobjectclass"]=>
string(12) "intorgperson"
["subschemasubentry"]=>
string(12) "cn=subschema"
["uid"]=>
string(7) "bryanir"
["givenname"]=>
string(5) "Bryan"
["sn"]=>
string(6) "Irvine"
["cn"]=>
string(12) "Bryan Irvine"
["userpassword"]=>
string(4) "blah"
["homedirectory"]=>
string(27) "/var/spool/mail/KCJ/bryanir"
["mail"]=>
string(11) "bryanir@KCJ"
["maildrop"]=>
array(1) {
[0]=>
string(16) "bryan.irvine@kcj"
}
["uidnumber"]=>
int(1003)
["gidnumber"]=>
int(1003)
["mailbox"]=>
string(35) "/var/spool/mail/KCJ/bryanir/Maildir"
}
What am I missing or doing incorrectly?