PHP LDAP克服大小限制 [英] PHP LDAP Overcoming Size Limit

查看:455
本文介绍了PHP LDAP克服大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常旧的网络盒,上面装有PHP4和LDAP的变体.

I have a very old network box, that has PHP4 and a variation of LDAP installed on it.

当返回的结果很小时,查询信息通常不是问题,但是我试图将所有条目都放在一个特定的CN中

Querying information isn't normally an issue when the returned results are small, but I'm trying to get all entries in one specific CN

结果为"警告:ldap_search()[function.ldap-search]:返回了部分搜索结果:超出了大小限制"

我读过的所有建议都是针对PHP5 +和Active Directory的,对于这个OLD而言毫无用处.

All the suggestions I've read have been for PHP5+ and Active directory, nothing for something this OLD.

希望您能提供帮助.

这是我非常简单的ldap查询. $r是连接.

This is my very simple ldap query. $r is the connection.

$result = ldap_search($r, "cn=location", "(cn=*)");
$entry = ldap_first_entry($r, $result);

do {
    $dn = ldap_get_dn($r, $entry);
    echo "DN is $dn\n";
} 
while ($entry = ldap_next_entry($r, $entry)); 

ldap_close($r);

这一直有效,直到我达到极限.我尝试使用LDAP_OPT_SIZELIMIT更改限制,但显然没有帮助.

This works until I hit the limit. I have tried changing the limit using LDAP_OPT_SIZELIMIT but obviously that didn't help.

我想知道的是..有什么方法可以计算条目,然后使用类似以下内容的批处理方式更小,更易于管理:

What I'm wondering is.. is there any way to count the entries and then process them in smaller more manageable batches using something like :

$sr=ldap_list($r, "cn=location","cn>=".$last_location);

有可能吗?还有其他想法吗?

Is that possible ? any other ideas ?

谢谢

推荐答案

根据 php.net/manual/...ldap-search ,您应该将$sizelimit参数设置为0以禁用内存限制.但是,如果这是导致错误的原因,它将不会覆盖LDAP服务器配置.

According to php.net/manual/...ldap-search, you should set the $sizelimit parameter to 0 to disable the memory limit. It will not, however, override the LDAP server configuration, if that is the cause of the error.

函数调用将类似于以下内容:

The function call will look something like the following:

ldap_search($r, "cn=location", "(cn=*)", null, 0, 0);

我不清楚filter参数的工作方式,因此如果在那里出现错误,则可能需要更改它. 有关ldap_search()的所有参数的说明,请参见上面的链接.

I'm not clear on how the filter parameter works, so you may need to change it if you get an error there. See the above link for descriptions on all of the parameters for ldap_search().

这篇关于PHP LDAP克服大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆