LDAP-Series-1-Chapter-3 - PHP-LDAP
If you want to use PHP with ldap. You have to add the extension lib.(ldap.so)
Go to the install file of PHP.
<?php require_once("m_ldap.php"); $mdap=new m_ldap(); $mdap->m_ldap_con(); $dn = "cn=root,ou=SystemAdmin,dc=xxx,dc=org"; $psw= "xxxxxx"; $mdap->m_ldap_bind($dn,$psw) or die("cannot bind"); $sdn="ou=people,ou=iWeb,dc=weiwejia,dc=org"; $filter="(uid=*)"; $res=$mdap->m_ldap_search($sdn,$filter); foreach( $res[0]["cn"] as $key=>$val){ print $key."\n"; print $val."\n"; }?>If everything has been ok, it will works now. (Need ACL support, introduce next chapter.)