I am attempting to do a simple bind to my active directory server off of a CentOS 7.6 server running apache and php 7.2.
<?php
$username = 'tester@domain.com';
$password = 'password';
$ldap=ldap_connect('ldap.domain.com');
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($bind = @ldap_bind($ldap, $username, $password)) {
echo "ok";
}
else{
echo "ldap_error: " . ldap_error($ldap);
ldap_get_option($ldap, LDAP_OPT_DIAGNOSTIC_MESSAGE, $err);
echo "ldap_get_option: $err";
}
I receive the following error:
ldap_error: Can't contact LDAP serverldap_get_option:
I ran the script from command line using 'php -f' and it comes back with 'ok' as intended. Any help getting this to run in the browser would be great.