0

I want to retrieve all data from all persons in a ldap server via php program. The ou is ou=people. The ldap server has 500 LIMIT so when i make (cn=*) i get all people who has some cn but i can only get 500 records. I tried to change size limit in my php but the limit is server side (at the moment i can't change that cause i can only query to that server)

<?php

$ldap_conn = ldap_connect($LDAP_Server, $port);
ldap_set_option($ldap_conn, LDAP_OPT_PROTOCOL_VERSION, 3);


if ($ldap_conn) {
    echo "Connection successful ";

    $ldap_bind_user = ldap_bind($ldap_conn);

    if (!$ldap_bind_user) {
        echo "anonymous bind is not successful <br/>";
        return;
    } else {
        echo "anonymous bind successful<br/>";
    }
}

// Search users in the group with gid 100
$base = "ou=People,dc=XX,dc=XX";
$filt = "cn=*";

$attributes = array('cn');

$sr = ldap_search($ldap_conn, $base, $filt, $attributes, null, 600, 1000, null);
$info = ldap_get_entries($ldap_conn, $sr);

Any idea to overcome this limit in php. I was thinking on making queries for each letter like, first with A, then B, ... But sometimes maybe the A letter has more than 500. I want to do it in automatic way, maybe someone has achieved that or can suggest a better solution.

Thanks in advance!

  • has been implemented in php 5.4 http://us3.php.net/manual/en/function.ldap-control-paged-result.php – guido Mar 13 '14 at 12:00
  • and there is a duplicate here http://stackoverflow.com/questions/1473075/enumerate-all-users-in-ldap-with-php – guido Mar 13 '14 at 12:01
  • Thank you very much! I think this could work for me! I'm not very used to ldap and php (it's my first approach) so i couldn't find it in the manual! ;) – user3086937 Mar 13 '14 at 12:09

0 Answers0