The ldap function page located at php.net states that PHP must be compiled with LDAP client libraries. I've downloaded OpenLdap - but it's for Linux. Also downloaded an exe version for Windows but it tries to setup an LDAP server and other things. Do I even need to install this?
How can I compile PHP w/these client libraries? I'm very new to php and confused about this part. Any help you can offer will be most appreciated. Thanks!
I'm using
PHP5
Apache2
OS - Windows
LDAP - Edirectory ( not sitting on local host) - I have a DER certificate for this that I've changed to a PEM certificate via openssl and saved in a directory called: C:\OpenLDAP\sysconf\certs
Code I am using to connect:
Code: Select all
<?php
$ldaphost = "ldaps://ipaddress";
$ldapUsername = "CN=****,OU=****,O=****";
$ldapPassword = "****";
$ds = ldap_connect($ldaphost);
if(!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){
print "Could not set LDAPv3\r\n";
}
else {
// now we need to bind to the ldap server
$bth = ldap_bind($ds, $ldapUsername, $ldapPassword) or die("\r\nCould not
connect to LDAP server\r\n");
}
?>