Hi,

I am using ldap_bind to connect to an Active Directory server to
authenticate users on a website. Although the script is running,
occasionally, and at random, the process to authenticate the user will take
almost exactly 75 seconds (within 100ths of a second). Other times the
authentication process will take less than a second.

Is there any way to see what is causing the delay, does anyone know which
logs I should be looking at. The webserver is a FreeBSD box, and the Domain
controller is a Windows 2000 box.

PHP Version: 4.3.4
Apache Version: 1.3.29
FreeBSD: 5.1
Open LDAP: openldap-client-2.0.27

My code is below.

<?
$ldapuser = "username";
$ldappass = "password";

//Script Time Debug -- START
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $starttime = $mtime;
//Script Time Debug -- START

$ldaprdn  = 'DOMAINNAME\\'.$ldapuser;
$ldapconn = @ldap_connect("dns.domain.com", 3268);
@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);

if ($ldapconn) {
 $ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
 if ($ldapbind) {echo "you are logged in";}
 else {echo "you are not logged in";}
 ldap_close($ldapconn);
 }

//Script Time Debug -- END
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $endtime = $mtime;
   $totaltime = ($endtime - $starttime);
   echo ("<script type='text/javascript'>alert('$totaltime')</script>");
//Script Time Debug -- END
?>

Thanks

Phil Dowson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to