Monday, April 09, 2012

Configure LDAP communication for PHP

1. Configure LDAP communication for PHP
Create the folder structure for C:/openldap/sysconf/
Create a new text file in C:/openldap/sysconf/ldap.conf
In this text file paste the following:
TLS_CACERT c:/openldap/sysconf/myserver.pem

Copy the ldap.conf into C:/ldap.conf and C:/windows/system32/ldap.conf
(Some versions of PHP look in these spots incorrectly for the ldap.conf)

2. Export Certificate for  LDAPs
Open Start -> Administrative Tools -> Certificate Authority.
Right click your server and select Properties.
Select View Certificate then select Details tab and press the "Copy to File..." button.
Export a Base-64 encoded X.509 (.CER) to your desktop as myserver.cer

Open the zip file and drag bin to C:/bin/ (We will delete this later)
Move the myserver.cer into C:\bin\myserver.cer
Open Start -> Run and type cmd.exe then hit enter.
Enter the following and press enter, this will create the myserver.pem certificate in c:\openldap\sysconf\myserver.pem:
C:\bin\openssl.exe x509 -in c:\bin\myserver.cer -out C:\openldap\sysconf\myserver.pem

3. Restart Apache

Copy From :