If you do not want to bind as unixadmin or *manager (i. e., for authentication on web applications), the following code could be useful:
<?php
$ldaphost = "ldap.yourdomain.com";
$ldapport = 389;
$ds = ldap_connect($ldaphost, $ldapport)
or die("Could not connect to $ldaphost");
if ($ds) {
$username = "some_user";
$upasswd = "secret";
$binddn = "uid=$username,ou=people,dc=yourdomain,dc=com";
$ldapbind = ldap_bind($ds, $binddn, $upasswd);
if ($ldapbind) {
print "Congratulations! $some_user is authenticated.";}
else {
print "Nice try, kid. Better luck next time!";}}
?>