title: Can't connect LDAP server - issue in ldap_bind();
body: <p>I am tried to implement a LDAP authentication in my web application developed in ZF2. LDAP authentication is working fine in Windows 7.</p>
  <p>But, after moving the application to LINUX machine, LDAP authentication is not working. I am always getting the error as : <strong>Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in LdapConnect.php on line 20</strong></p>
  <p>I have used the scripts as:</p>
  <pre><code>$ldaphost = &quot;ldap://xxxx.net&quot;;
  $ldapport = 389;
  $ds = ldap_connect($ldaphost, $ldapport) or die(&quot;Could not connect to $ldaphost&quot;);
  if ($ds)
  {
      $username = &quot;username@xxxx.net&quot;;
      $upasswd  = &quot;password&quot;;
      $ldapbind = ldap_bind($ds, $username, $upasswd);
  
      if ($ldapbind)
      {
         print &quot;Congratulations! you are authenticated successfully.&quot;;
      }else{
        print &quot;Better luck next time!&quot;;
      }
  }
  </code></pre>
  <p>Should I install any software package or should I do any config settings?</p>
  <p><strong>Note:</strong> <em>If I give the IP adress then it is working fine, but if I give the domain name, then it is <strong>not working.</strong></em></p>