I need to authenticate user in active directory in php (using yii framewrok). On one of computer in the network I have virtual machine with windows 2008 server with active directory (port 5000 is used) and I try to connect it using ldap and authenticate user. Controller name is (server1.domain_name).
My code is like this one:
$hostName = '192.168.139.94';
$port = 5000;
$userName = 'User1@domain_name';
$password = 'password';
$ldap = ldap_connect($hostName, $port);
if ($bind = ldap_bind($ldap, $userName, $password)) {
echo 'success';
// log them in!
} else {
// error message
echo 'failed';
}
But get warning:
ldap_bind() [<a href='function.ldap-bind'>function.ldap-bind</a>]: Unable to bind to server: Can't contact LDAP server
Could you please tell what's the problem? How to get more information what causes problem?