2

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?

George
  • 901
  • 9
  • 23

2 Answers2

2

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.

Jon Skarpeteig
  • 4,118
  • 7
  • 34
  • 53
  • 1
    Thanks for your help, the debugging option would be very useful in diagnosing it. Strangely, I believe the issue was DNS related, despite both dev and prod environments using the same DNS server. I solved it by simply changing the LDAP server being called in ldap_connect() to the IP address rather than the FQDN. Thanks for your help. – George Apr 20 '11 at 13:32
1

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.