Running PHP 5.4.16. Here's the (simplified) code:
<?php
$username = "username";
$password = "password";
$ldap = ldap_connect("ldaps://ldap.domain.xyz", 636);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
$bind = ldap_bind($ldap, $username, $password);
ldap_unbind($ldap);
?>
And here's the LDAP section of phpinfo:
ldap
LDAP Support => enabled
RCS Version => $Id$
Total Links => 0/unlimited
API Version => 3001
Vendor Name => OpenLDAP
Vendor Version => 20440
SASL Support => Enabled
Directive => Local Value => Master Value
ldap.max_links => Unlimited => Unlimited
No matter what I try, I get the same "ldap_bind(): Unable to bind to server: Can't contact LDAP server" error. SELinux already has httpd_can_connect_ldap --> on set, and I've also tried disabling SELinux entirely which didn't help. Everything else I can turn up suggests firewall/credentials issues or configuration problems on the server side, but:
- I am one hundred percent positive that I'm using the right credentials.
- I can telnet to the LDAP server on port 636 so I'm reasonably sure it's not a firewall issue.
- This same code works fine on a different machine (which is running PHP 5.3.3) with the same credentials.
I'm kind of at my wit's end. Anyone have any ideas what it could be?