Reputation: 901
I have a strange problem on a production server running Debian squeeze with Apache 2.2.16 and PHP 5.3.3-7 and Suhosin. On my development machine, Windows 7 64bit running XAMPP, I don't have the same problem.
The problem is: I am using the adLDAP PHP API to access a Windows Active Directory Domain Controller, and on the production box, there is a 5 second delay sometimes calling ldap_bind(). I don't get this on the development box - and they are accessing the same LDAP server with the same details and credentials.
ldap_connect() executes fine, but it's ldap_bind() that is giving me the error. I have confirmed this through logging with CodeIgniter.
Can anyone point me in the right direction?
Upvotes: 2
Views: 2799
Reputation: 11
I had this problem as well. It appears to have been a DNS problem for me too. I pinged the server twice and got two different IP addresses. One timed out, the other didn't. I used the good IP address in the ldap_connect rather than the name and the problem is gone.
Upvotes: 1
Reputation: 4128
To further see what's going on you can enable debug output of the ldap module:
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
5s is typically a timeout against the server. And when you say it only happens sometimes, and only on production, suggest that the problem is in your network rather than in your code.
Upvotes: 2