Re: LDAP SSL with Active Directory
| From: | Merijn Evertse | Date: | Wed, 16 Apr 2003 11:52:02 +0000 |
| Subject: | Re: LDAP SSL with Active Directory | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19443@lists.php.net to get a copy of this message | ||
Here is the code that i use:
$ldaphost = "ldaps://myserver.mydomain.nl";
echo "LDAP connecting...<BR>";
$ldapconn = ldap_connect($ldaphost);
if ($ldapconn) {
// binding to ldap server
$ldaprdn = "mydn";
$ldappass = "mypass";
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
printf("LDAP-Errno: %s<br>\n", ldap_errno($ldapconn));
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...<br>";
} else {
echo "LDAP bind failed...<br>";
}
} else {
echo "LDAP connect to $ldaphost failed...<br>";
}
// Close LDAP
echo "LDAP closing...<BR>";
ldap_close($ldapconn);
The errno I get is 81 (SERVER-DOWN).
But my server is up and running, and if I check with a commandline ldap
client which works perfectly.
"Merijn Evertse" <merijn@sara.nl> wrote in message
news:20030416112040.67278.qmail@pb1.pair.com...
> Hello,
>
> <speedfreak@chello.be> wrote in message
news:3E9D1856.9A658266@chello.be...
> > Merijn Evertse wrote:
> >
> > > Hello,
> > >
> > > I am trying to authenticate a user on the Active Directory LDAP
database
> of
> > > Windows 2000 Server (SP3) Domain Controller.
> > > Over normal LDAP this works fine. But when i try to use SSL for LDAP
the
> > > connection fails.
> > >
> > > PHP Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP
> > > server in <my script>
> > >
> > > I am using PHP 4.3.1 on an IIS5 webserver on Windows 2000 Server
(SP3).
> > >
> > > Is SSL support build into this PHP version? or do I need to extend
it...
> > > I copied the libeay32.dll file to C:\Winnt\System32 but it didn't
help.
> > >
> > > Regards,
> > >
> > > Merijn Evertse
> >
> > Hi, Merijn
> > Get the PHP win32 openssl wrapper from
> > http://ftp.proventum.net/pub/php/win32/misc/openssl
> > Works great for me (using Apache though, so YMMV).
> >
> > Veel plezier!
> > speedfreak[at]chello.be
> >
>
> I tried this and according to phpinfo() OpenSSL 0.9.6 is running. However
it
> is still nog working. ldap_bind fails.
>
> Regards,
>
> Merijn Evertse
>
>