title: PHP ldap_search in Active Directory subgroups
body: <p>I have an AD group <strong><em>Students</em></strong> that has group <strong><em>ClassA</em></strong> as its member.</p>
  
  <p>User <strong><em>John</em></strong> in an AD group <strong><em>ClassA</em></strong>:</p>
  
  <pre><code>Students --&gt; ClassA --&gt; John
  </code></pre>
  
  <p>I am running <em>ldap_search()</em> on the <strong><em>Students</em></strong> group looking for <strong><em>John</em></strong>:</p>
  
  <pre><code>$filter = '(&amp;(objectClass=user)(sAMAccountName=John) (memberof=CN=Students,OU=Groups,OU=Units,dc=ad,dc=aaa,dc=bbb))';
  
  $result = ldap_search($ldap_resource, $ldap_domain, $filter);
  </code></pre>
  
  <p>The search turns out unsuccessful.</p>
  
  <p>However, if I move the user directly under <strong><em>Students</em></strong>:</p>
  
  <pre><code>Students --&gt; John
  Students --&gt; ClassA
  </code></pre>
  
  <p>The user is being successfully found.</p>
  
  <p>How do I search recursively in subgroups?</p>