Binding to LDAPS using PHP failing

Posted by Sean on Server Fault See other posts from Server Fault or by Sean
Published on 2012-11-05T02:35:54Z Indexed on 2012/11/05 5:03 UTC
Read the original article Hit count: 375

Filed under:
|
|

We've finally set-up our server to accept ldap SSL connections thanks to another question answered by a helpful member.

Our problem now is that when attempting to bind to ldap using the below simple PHP script, we constantly fail. Binding using ldap instead of ldaps works just fine using the script so I know the ldap is enabled. The catcher is that while using LDP.exe, we can successfully connect and bind to ldap on port 636 using a secure connection.

The script we are failing with is below:

<?php
$ldap = ldap_connect("ldaps://localhost");
$username="user";
$password="pass";

if($bind = ldap_bind($ldap, $username,$password ))
echo "logged in";
else
    echo "fail";
    echo "<br/>done";
    ?>

We've also attempted inputting the username as "user@domain" or "domain/user" with no success. It seems I'm forever having LDAP/Cert questions. Our environment is Server 2008.

© Server Fault or respective owner

Related posts about php

Related posts about iis7