Re: Slow LDAP Queries

xyzzy
Date: 12/17/03


Date: Tue, 16 Dec 2003 23:09:06 -0500


"Phil Dowson" <webmaster@aea9.k12.ia.us> wrote in message
news:20031216160200.24417.qmail@pb1.pair.com...
> 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

Hard to say.
I have used both Netscape & openldap servers without problems. Maybe
something with the M$ domain settings ? ...
I would try the command line ldapsearch utility that you have installed
first. This will possibly eliminate PHP as the culprit.
Also, you may want to try installing ethereal or some other packet sniffer.



Relevant Pages

  • Implementing a captive portal with iptables.
    ... I'm experimenting with iptables and dinamic changing of rules for ... authenticate users from a web interface and mysql db as backend. ... If I still have the redirect rule that redirects all dport 80 traffic ...
    (comp.os.linux.networking)
  • NTLM Auth For grabbing data.
    ... I'm needing to authenticate against that with php. ... I can manually provide the details but the http auth script only ... I'm not trying to have the user authenticate against it. ... Make every part of your body a slavethat pleases God. ...
    (php.general)
  • Re: LDAP Auth Problem - COM interop
    ... I'm trying to use LDAP to authenticate users. ... Public Function IsAuthenticated(ByVal domain As String, ... Dim entry As DirectoryEntry = New DirectoryEntry(_path, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Reading unix group info and user info
    ... Steve wrote: ... > servers using PHP? ... are you basically trying to authenticate people against ...
    (alt.php)
  • Re: Reading unix group info and user info
    ... Steve wrote: ... > servers using PHP? ... are you basically trying to authenticate people against ...
    (comp.lang.php)