dongtang6718 2014-07-23 14:33
浏览 231
已采纳

PHP LDAP克服大小限制

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

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

This results in 'Warning: ldap_search() [function.ldap-search]: Partial search results returned: Sizelimit exceeded'

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

I'm hoping you can help.

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
";
} 
while ($entry = ldap_next_entry($r, $entry)); 

ldap_close($r);

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 ?

Thanks

  • 写回答

1条回答 默认 最新

  • douji8033 2014-07-23 14:45
    关注

    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);
    

    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().

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题