title: PHP LDAP Connection
body: <p>I'm trying to connect in LDAP with php-ldap. I got a issue using <code>ldap_bind()</code>:</p>
  
  <pre><code>$username = 'josue.ruiz';
  $password = 'pass';
  $ldapconfig['host'] = '10.10.10.11';
  $ldapconfig['port'] = 389;
  $ldapconfig['basedn'] = 'dc=domain,dc=com';
  
  $ds=ldap_connect($ldapconfig['host'], $ldapconfig['port']);
  ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
  ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
  
  $dn="cn=".$username.",ou=Technology,".$ldapconfig['basedn'];
  
  if ($bind=ldap_bind($ds, $dn, $password)) {
      echo("Login correct");
  } else {
      echo("Login incorrect");
  }
  </code></pre>
  
  <p>I get this message:</p>
  
  <blockquote>
    <p>Warning: ldap_bind(): Unable to bind to server: Invalid credentials in ...</p>
  </blockquote>
  
  <p>But when I try this way:</p>
  
  <pre><code>ldap_bind($ds,'josue.ruiz@domain.com','pass'); 
  </code></pre>
  
  <p>It works fine, but to me it doesn't work because I want to filter by <code>OU</code>, and with this way I can't. Does anyone have any advice for this problem?</p>