<?php $ldap="ldap-srv.mydomain.com"; $usr="uid=srv-acc,ou=serviceaccounts,dc=sub,dc=mydomain,dc=com"; $pwd="secret"; $ds=ldap_connect($ldap); $ldapbind=false; if(ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) if(ldap_set_option($ds, LDAP_OPT_REFERRALS, 0)) if(ldap_start_tls($ds)) $ldapbind = @ldap_bind($ds, $usr, $pwd); $ldapse = ldap_search($ds,"dc=sub,dc=mydomain,dc=com","uid=my.user"); var_dump(ldap_get_entries($ds,$ldapse)); ldap_close($ds);?>