Search code examples
phpcodeigniterldapadldap

5 second delay on ldap_bind() to Active Directory


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?


Solution

  • 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.