我在 apache 服务器上有一个 PHP 脚本,每次我尝试运行它时,它都会告诉我:
unable to bind to the AD
不过连接很好。我把它从 apache 服务器上取下来,从我的机器上本地运行它,它能够很好地绑定。我假设我的 apache 配置有问题。
我正在使用adLDAP API,这是我正在尝试运行的以下脚本。它基本上是一个测试,看看我是否能够成功绑定并检查输入的凭据是否在 Active Directory 中。
$username = $_POST["username"];
$password = $_POST["password"];
$formage = $_POST["formage"];
if ($_POST["oldform"]) { //prevent null bind
if ($username != NULL && $password != NULL){
//include the class and create a connection
include (dirname(__FILE__) . "/../src/adLDAP.php");
try {
$adldap = new adLDAP();
}
catch (adLDAPException $e) {
echo $e;
exit();
}
//authenticate the user
if ($adldap->authenticate($username, $password)){
//establish your session and redirect
session_start();
$_SESSION["username"] = $username;
$_SESSION["userinfo"] = $adldap->user()->info($username);
$redir = "Location: https://" . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/menu.php";
header($redir);
exit;
}
}
$failed = 1;
}
为什么我会收到此错误:unable to bind to the AD
?