ok so i have a problem: ldap_bind without SSL works just fine but when i switch to SSL it doesn't bind. The simple code im testing this with looks like this


// LDAP variables
$ldaphost = "ldaps://myserver.com";  // your ldap servers
$ldapport = 636;                 // your ldap server's port number

// Connecting to LDAP
$ldapconn = @ldap_connect($ldaphost, $ldapport);
// LDAP settings
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
if($ldapconn) {
	echo "LDAP connection works<br />";
else {
	echo "LDAP connection doesn't work<br />";
// LDAP binding anonymously
$ldapbind = ldap_bind($ldapconn);

if ($ldapbind) {
	echo "LDAP bind anonymous successful";
} else {
	echo "LDAP bind anonymous failed";


And after refreshing the page it echoes:

LDAP connection works
LDAP bind anonymous failed

I've been googling like a maniac and everywhere it says that LDAP with SSL should work like that but it doesn't :( It can't be anything with the code? Some serverside issue? And the binding works just fine without SSL...

7 Years
Discussion Span
Last Post by jstrain@gpc.edu
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.