I use server name, not IP address. It works for ping, so domain name resolving is ok I guess. Will it make a difference still?
It just hangs at the ldap_connect as though waiting for the answer.
if( ($username <> "") && ($password <> "") ){
$alive = false;
$server = 'myserver.mydomain.com';
// Check connection for 1 sec
$script = 'ping -w 1 '.$server.' >> /dev/null ; echo $?';
exec("$script 2>&1", $out);
if ($out[0] == '0') {
$alive = true;
}
// Check connection for 5 sec
if (!$alive) {
$script = 'ping -w 1 '.$server.' >> /dev/null ; echo $?';
exec("$script 2>&1", $out);
if ($out[0] == '0') {
$alive = true;
}
}
if ($alive) {
$ldap = @ldap_connect($server);
}
if($alive && $ldap){
if(@ldap_bind($ldap, $username, $password)){