ldap-start-tls to connect to AD server

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I try to use ldap-star-tls to connect to a win2003 domain controller and
browse AD.

$ds = ldap_connect("ldap://$ad_server/") ,"389");     // Connect to an LDAP
    echo $debug?"<BR>LDAP Connection handler:$ds<BR>":"";
    if ($ds == 0) {
        echo "<H1>Cannot connect to LDAP server to authenticate</H1>";
        echo "<H3>Use the browser back button to continue</H3>";
    else {
        if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
            die ("Failed to set LDAP Protocol version to 3, TLS not
        if (!ldap_start_tls($ds)) {
            die ("Ldap_start_tls failed");
        if (ldap_bind ($ds, $serv_user, $serv_pass)) { # Bind Ok

The result is:
LDAP Connection handler:Resource id #2

Warning: ldap_start_tls() [function.ldap-start-tls]: Unable to start TLS:
Connect error in C:\WEBROOT\ad.php on line 30
Ldap_start_tls failed


Luca Bighi

Site Timeline