无法使用PHP绑定LDAP

时间:2015-03-06 08:13:09

标签: php binding ldap bind

我尝试使用PHP绑定LDAP并收到此错误

    Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Can't contact LDAP server on line 21

第21行的脚本就是这个..

    $bind_status = ldap_bind($conn_status, $app_user, $app_pass);

以下是在LDAP中连接的脚本:

   $conn_status = ldap_connect('ldaps://ldap.domain.com/', 389);
    if ($conn_status === FALSE) {
        die("Couldn't connect to LDAP service");
    } else {
        echo "Successful! <br/>";
    }

以下是绑定到LDAP的脚本:

    $app_user = 'cn=user, dc=domain, dc=com';
    $app_pass = 'password';

    $username = 'user'; //same as cn
    $password = 'password'; //same as $app_pass

    $bind_status = ldap_bind($conn_status, $app_user, $app_pass);
    if ($bind_status === FALSE) {
        die("Couldn't bind to LDAP as application user");
    } else {
        echo "Bind to LDAP successfully <br/>";
    }

我更新的LDAP绑定脚本

    $bind_status = ldap_bind($conn_status, $username, $password);
    if ($bind_status === FALSE) {
        //die("Couldn't bind to LDAP <br/>");
        echo "LDAP-Errno: " . ldap_errno($ds) . "<br />";
    } else {
        echo "Bind to LDAP successfully <br/>";
    }

现在我收到了这个错误:

    Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Operations error on line 21

第21行是这样的:

    $bind_status = ldap_bind($conn_status, $username, $password);

请帮我解决这个问题。谢谢

0 个答案:

没有答案