title: PHP ldap_connect + ldap_bind unable to bind
body: <p>I have this PHP code:</p>
  
  <pre><code>$ldap = ldap_connect("aaa.bbbbb.cc")
      or die("Could not connect to LDAP server.");
  
  ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
  ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
  
  $ldapbind = ldap_bind($ldap);
  
  if ($ldapbind) {
      echo "LDAP bind successful...";
  } else {
      echo "LDAP bind failed..."; //end up here
  }
  </code></pre>
  
  <p>And I'm unable to make it bind successfully, I have tried all sorts of combinations.
  Passing credentials, using an URI with "ldap://".</p>
  
  <p>The following C# code works fine when binding to the same LDAP server:</p>
  
  <pre><code>var connection = new LdapConnection("aaa.bbbbb.cc");
  connection.Bind();
  </code></pre>
  
  <p>The LDAP API for PHP seemssomewhat hard to debug, since if bind fails, you don't get any result, so I have no idea how to see what fails, if it cant access the server, bad credentials, or something else..</p>
  
  <p>So, any ideas what could cause the PHP code to fail? is there something special I need to do?
  (LDAP extension is enabled for PHP)</p>