LDAP authentication - ldap_bind() method is very slow
My application has ldap authentication for users.
When i authenticate its taking very long time to complete about 10 to 15 seconds. If I immediately logout and login again. Its just taking 100ms or something very slow time. After some time when i try login again it again taking 10-15 seconds.
It is very fast when we connect from my personal windows machine, but taking time from our web server machine.
What could be the reason behind this issue ?
Below is my code it succeeds but but take time to complete. If I refresh this page again its instantaneous.
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); //Our Ip address \/ $l = ldap_connect("ldap://22.214.171.124:389"); ldap_set_option($l, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($l, LDAP_OPT_REFERRALS, 0); //This takes very long time. ldap_bind($l, "CN=work,OU=XX-ALL,DC=Example,DC=com", "workPassword"); echo(ldap_error($l)."\n");