The task is to establish a connection to an Active Directory or Lightweight Directory Access Protocol server.

<?php
$ldap = ldap_connect($hostname, $port);
$success = ldap_bind($ldap, $username, $password);