LDAP Bind over SSL problems
Posted: Tue Apr 23, 2013 2:08 pm
I'm very new to PHP and just trying to help another developer debug an LDAP query over SSL via PHP.
We are working with PHP 5.3 and 5.4 (different servers) and Windows 2008 R2.
Our code is similar to below:
It generates the following error:
Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in E:\wp\Test.php on line 36 Warning: ldap_errno() expects parameter 1 to be resource.
The value of $ldaphost is False, which as I understand it means no connection was made.
According to http://greg.cathell.net/php_ldap_ssl.html the ldap.conf file and put it in C:\openldap\sysconf. This is where my ignorance comes in. It does not appear that either 5.3 or 5.4 have this dirrectory. Where am I supposed to put the ldap.conf file in these versions? Is there a better way of debugging the LDAP errors?
We've spent a week or more trying to figure this out without a lot of success. Any help would be appreciated. Thank you.
We are working with PHP 5.3 and 5.4 (different servers) and Windows 2008 R2.
Our code is similar to below:
Code: Select all
ini_set('display_errors', 'On');
putenv('LDAPTLS_REQCERT=never');
$ldaphost = "ldaps://myserver.edu:636";
$ldapconn = ldap_connect($ldaphost);
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass) ;
or die( print_r($ldapbind). '****' .ldap_errno($ldapbind).'------'.ldap_err2str( ldap_errno($ldapbind ) ) );Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in E:\wp\Test.php on line 36 Warning: ldap_errno() expects parameter 1 to be resource.
The value of $ldaphost is False, which as I understand it means no connection was made.
According to http://greg.cathell.net/php_ldap_ssl.html the ldap.conf file and put it in C:\openldap\sysconf. This is where my ignorance comes in. It does not appear that either 5.3 or 5.4 have this dirrectory. Where am I supposed to put the ldap.conf file in these versions? Is there a better way of debugging the LDAP errors?
We've spent a week or more trying to figure this out without a lot of success. Any help would be appreciated. Thank you.