PHP LDAP SSL Authentication - Unable to bind to server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crouchm
Forum Newbie
Posts: 1
Joined: Wed Aug 31, 2005 2:54 pm

PHP LDAP SSL Authentication - Unable to bind to server

Post by crouchm »

Hi! I have been trying to connect to Novell E-Directory LDAP server via ssl in php. I have enabled the extension for ldap in php and copied the correct files to windows directory. However when I attempt to login, I get an error of Unable to bind to server: Can't contact LDAP server.

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");
}
?>
Burrito: Use php tags you should when Posting Code In The Forums you are
Post Reply