使用LDAP OSX 10.8进行身份验证?

I am trying to implement a login for users on a web application I am developing, using Open Directory and authenticating the user through LDAP. However I am receiving an error of:

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server in /ldap/login.php on line 18 Access Denied!

My only requirement is to authenticate a user through LDAP to view a restricted page. Much in the same way a user is authenticated using a database.

I ran simple test, To open a connection however the code below failed to authenticate

<?php
set_time_limit(30);
error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
ini_set('display_errors',1);

$ldaphost = "ldaps://11.4.9.3";
$ldapport = 636;

$ds = ldap_connect($ldaphost, $ldapport)
or die("Could not connect to $ldaphost");

if ($ds) 
{
$username = "my LDAP login";
$upasswd = "my LDAP password";

$ldapbind = ldap_bind($ds, $username, $upasswd);

if ($ldapbind) 
    {print "Congratulations! $username is authenticated.";}
else 
    {print "Access Denied!";}
}
?>

Any help would be much appreciated, if somebody has covered the same process I would like to know how it can be achieved.