那我在LINUX下架的服务器跑PHP时,登录的用户和账号用LDAP通过域服务器来验证,可以吗?

解决方案 »

  1.   

    <?php// using ldap bind *** NOTE the uname *****
    $ldaprdn  = "uid=username,ou=people,dc=172.18.100.3"; //这里这样写可以吗? 
    $ldappass = "password";  // associated password// connect to ldap server
    $ldapconn = ldap_connect("172.18.100.3")
       or die("Could not connect to LDAP server.");if (ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3)) {
       echo "Using LDAPv3";
    } else {
       echo "Failed to set protocol version to 3";
    }if ($ldapconn) {   // binding to ldap server
       $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);   // verify binding
       if ($ldapbind) {
           echo "LDAP bind successful...";
       } else {
           echo "LDAP bind failed...";
       }}?> 
    我这样写的话,我域服务器的域名我不知道,DC那里写IP可以吗?上面代码还是会报
    Using LDAPv3
    Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials in F:\BS Projects\test.php on line 20
    LDAP bind failed...