I am trying to implement LDAP authentication in my web application developed in ZF2. LDAP authentication works fine in Windows 7.
But after porting the application to the LINUX machine, LDAP authentication does not work. I always get an error like: Warning: ldap_bind (): Cannot bind to the server: cannot connect to the LDAP server in LdapConnect.php on line 20
I used scripts like:
$ldaphost = "ldap://xxxx.net";
$ldapport = 389;
$ds = ldap_connect($ldaphost, $ldapport) or die("Could not connect to $ldaphost");
if ($ds)
{
$username = "username@xxxx.net";
$upasswd = "password";
$ldapbind = ldap_bind($ds, $username, $upasswd);
if ($ldapbind)
{
print "Congratulations! you are authenticated successfully.";
}else{
print "Better luck next time!";
}
}
Do I have to install any software package or any configuration settings?
Note. . If I give an IP address, it works fine, but if I give a domain name, then it does not work.
Please help me solve the problem.