I am trying to connect to the LDAP server with Laravel-Adldap2. The same config works on another server and on local machine.
I am using secured LDAPS connection (port 636).
But on one of the test servers, I get:
Can't contact LDAP server.
I have LDAP_USE_TLS=false
and LDAP_USE_SSL=true
in my .env
file.
To further debug that, I made a vanilla PHP LDAP connection script:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
putenv('LDAPTLS_REQCERT=never');
// using ldap bind
$ldaprdn = 'uname'; // ldap rdn or dn
$ldappass = 'password'; // associated password
$ldapconn = ldap_connect("ldaps://ldap.example.com:636")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
and I get:
TLS certificate verification: Error, unable to get local issuer certificate.
TLS trace: SSL3 alert write:fatal:unknown CA
TLS trace: error in error
TLS: can't connect: error:16000069:STORE routines:unregistered scheme.
ldap_err2string
PHP Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server
Now I am not sure if the error I get from the vanilla PHP script is related to the Adldap2 error, because maybe putenv('LDAPTLS_REQCERT=never');
doesn't work like LDAP_USE_TLS=false
? So I am not sure what exactly cause the Adldap2 error and what causes the vanilla PHP script error, but I know that the same credentials work on other servers.
How can I debug this further? (I don't want to use TLS but I do want SSL - how can I be sure I do that with the vanilla PHP script?)