LDAPS Authentication against MS Active Directory

From: Date: Wed, 08 May 2002 22:46:58 +0000
Subject: LDAPS Authentication against MS Active Directory
Groups: php.windows 
Request: Send a blank email to php-windows+get-13639@lists.php.net to get a copy of this message
Good afternoon, everyone. I was wondering if anyone has been able to make PHP's ldap_connect() and ldap_bind() functions work over secure LDAP against Microsoft's Active Directory services. My ultimate goal is to be able to change the password in Active Directory. Microsoft states that a Secure LDAP connection MUST exist before password changes over the LDAP mechanism can occur. I installed Active Directory onto a domain controller and added the Enterprise Certificate Authority to the system, thereby creating a server certificate. From that point, I added a "Domain Controller" Automatic Certificate Request entry in the Domain Controller Security Policy tool. This, according to MS's KB documents, establishes the Secure LDAP functionality on port 636. After creating the Domain Controller element, I can telnet to the machine on port 636 and at least get a blank screen response, whereas before I got nothing but a "refused connection" message. Here is some code from the script I am trying to make work: // Userinfo to access AD $HOST = "ldaps://hostname.domain.com"; $USER_DN = "username@domain.com"; $PWD = "password"; //The connection to AD $ldap_handle=ldap_connect($HOST); $ds=ldap_bind($ldap_handle,$USER_DN,$PWD); With the above code, the script returns the following message: Warning: LDAP: Unable to bind to server: Can't contact LDAP server in ldapscript.php on line 28 If, however, I use $HOST = ldap://hostname.domain.com; (regular LDAP - 389) then the bind() works and everything else in the script works. If anyone has made this work, I would appreciate hearing from you on how to make it work!! Thanks, George Blessing

« previous php.windows (#13639) next »