[英]Ldap_add() : Invalid Syntax
I have a program here that uses the ldap_add, when i try to run the program, it displays an error: 我这里有一个使用ldap_add的程序,当我尝试运行该程序时,它显示错误:
Warning: ldap_add() [function.ldap-add]: Add: Invalid syntax in /var/www/suey/costcenter.20090617.php on line 780
警告:ldap_add()[function.ldap-add]:添加:第780行的/var/www/suey/costcenter.20090617.php中的语法无效
My lil' code here is: 我这里的lil代码是:
$ldapservers = 'ourServer';
$ds = ldap_connect($ldapservers);
if ($ds) {
$r = ldap_bind($ds, $ldaprootun, $ldaprootpw);
$add = ldap_add($ds, "uid=$fuid, $ldapbasedn", $infonew);
}
ldapbasedn is set to o=ourGroup;
ldapbasedn设置为
o=ourGroup;
infonew is an array of entries (person information) and am so sure that the array is not empty because i already tested it. infonew是一个条目数组(个人信息),因此请确保该数组不为空,因为我已经对其进行了测试。 the uid is not empty too.
uid也不为空。 What could be wrong?
有什么事吗 Is it the entries(array)?
是条目(数组)吗? or the server am trying to connect to?
或服务器正在尝试连接? I tried testing the ldap_bind, and it also works well too..hmmm..
我尝试测试ldap_bind,它也很好用..hmmm ..
Pls help.. thanks! 请帮助..谢谢!
I found the problem.. it's in the index infonew["createdBy"] = getenv("REMOTE_USER"); 我发现了问题..它在索引infonew [“ createdBy”] = getenv(“ REMOTE_USER”);中。 it returns NULL!
它返回NULL! now, is that right?
现在,对吗?
Can you please post a var_dump($infonew)
(or print_r($infonew)
)? 您可以发布
var_dump($infonew)
(或print_r($infonew)
)吗?
I strongly assume that there is some data in $infonew
that cannot be written to the LDAP server. 我强烈认为
$infonew
中有一些数据无法写入LDAP服务器。
EDIT: 编辑:
You cannot use null
in the LDAP data array. 您不能在LDAP数据数组中使用
null
。 Either strip the appropriate key ( createdBy
) from the array or set the value to array()
. 从数组中删除适当的键(
createdBy
)或将值设置为array()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.