Good Morning folks,
I have several scripts which talk to an enterprise LDAP ( MS Active Directory ). I'm finding that if I don't throttle my scripts with sleep() commands I get the following error:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in..
What most of my scripts do is get members of Active Directory objects, then finding the members of those results.
I have a function called getMembers() that calls itself while running through the members that it has retrieved, until there are no more results.
I'm finding that I have to:
sleep(1);
getMembers();
For my bind not to fail and time out.
I'm wondering if there is a better way to hammer the crap out of ldap without being kicked out halfway through my scripts. The 1 second pause is going to cause my script to take 97 hours to process all of it's items and I'd like to cut that time by half so I can have it run over the weekend.
Thanks
EDIT --------------------------
So I found out through research that there is a 1000 record limit in LDAP and PHP has no way to page results from LDAP. Due the the way I'm querying LDAP ( 1 query at a time ) I'm able to have it count every iteration that calls to LDAP and when that counter reaches 900 or so, I have it sleep for a minute. This way I'm getting more results. I haven't been able to find a solution for the ldap paging in PHP though.