<?php
$host = "127.0.0.1:10389";
$ldap = ldap_connect($host);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
$username = "uid=admin,ou=system";
$password = "secret";
if( $bind = ldap_bind($ldap, $username, $password) )
echo( "logged into ".$host." as ".$username );
else
echo( "Fail" );
?>