title: Supplied resource is not a valid ldap result entry resource: ldap_get_attributes()
body: <p>I've just started working on <code>LDAP</code> and trying make an connection between <code>PHP</code> &amp; <code>LDAP</code>.</p>
  
  <p>I've created small script to get all attributes information by referring <a href="http://www.phpdig.net/ref/rn33re632.html" rel="nofollow">this</a>
  script.</p>
  
  <pre><code>$ldap_server = "My_Server_Name";
  $ldap_user = "uid=platypus,ou=users,dc=crowd";
  $ldap_pass = "My_Password";
  
  $ad = ldap_connect($ldap_server);
  ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
  $bound = ldap_bind($ad, $ldap_user, $ldap_pass);
  
  $result = ldap_read($ad, $ldap_user, "objectClass=*");
  $attributes = ldap_get_attributes($ad, $result);
  
  echo "&lt;pre&gt;";
  print_r($attributes);
  </code></pre>
  
  <p>Connection is successfully made, its binding properly as well and <code>ldap_read</code> also giving me <code>#resourse id</code> but <code>ldap_get_attributes</code> giving me following error:</p>
  
  <blockquote>
    <p>PHP Warning – yii\base\ErrorException
        ldap_get_attributes(): supplied resource is not a valid ldap result entry resource</p>
  </blockquote>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks</p>