如何在PHP中以编程方式将posixAccount添加到LDAP?

时间:2015-09-06 18:24:02

标签: php ldap lamp openldap ldap-query

我无法将posixAccount添加到我的本地LDAP目录;我的代码如下:

$ldap = ldap_connect("localhost") or die("unable to connect to   server..");
ldap_set_option($ldap,LDAP_OPT_PROTOCOL_VERSION,3);

$accountDn = "cn=admin,dc=blackboard,dc=com";
ldap_bind($ldap,$accountDn,"root");

$accountDn = "cn=AkPaul,dc=blackboard,dc=com";
$entry["cn"] = "AkPaul";
$entry["gidNumber"] = "Testing";
$entry["givenName"] = "Ak";
$entry["homeDirectory"] = "/home/users/akpaul";
$entry["objectClass"][0] = "inetOrgPerson";
$entry["objectClass"][1] = "posixAccount";
$entry["password"] = "021091ap";
$entry["sn"] = "Paul";
$entry["uidNumber"] = "1004";
$entry["uid"] = "akpaul";
var_dump($entry);

ldap_add($ldap,$accountDn,$entry) or die("Unable to connect to server");

error message is Add: Invalid syntax

我做错了什么?

0 个答案:

没有答案