我试图在我们公司的Web门户中实现LDAP验证。我可以成功连接到主机,但我似乎无法获得与Active Directory凭据的成功绑定。寻找一些可能出错的帮助。任何帮助,提示或建议将不胜感激。PHP LDAP验证不工作
$username = $_POST['username'];
$password = $_POST['password'];
$host = "xxx.xxx.xxx.xxx";
$port = "389";
$connection = ldap_connect($host, $port) or die("Could not connect to LDAP server.");
ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($connection) {
$bind = ldap_bind($connection, $username, $password);
if ($bind) {
echo "LDAP bind successful";
}
else {
echo "LDAP bind failed";
}
}
你检查日志?任何错误,什么**不工作**?你还使用登录DOMAIN \ USERNAME? – Jakub