在Windows LDAP认证(LDAP Authentication on Windows)

2019-07-03 19:57发布

我有一个64位的Windows平台和PostgreSQL 8.4安装(例如Apache公司,EnterpriseDB,ApachePHP安装在Pstgres)。我需要使用Active Directory(或LDAP?)凭证,但即使艰难我启用LDAP并重新启动Apache就以系统的身份验证错误日志中我看到PHP的致命错误:调用未定义功能ldap_connect()的路径/要/我的/ phpfile .. PHP脚本我用的是下面,

<?php

$user = $_POST["myUserName@mydomain.com"];
$pass = $_POST["muPassword"];
//in our system, we already use this account for LDAP authentication on the server above
$ldap_serv = 'ldap://192.168.69.10';
$ldap_port = '389';
$lc = ldap_connect($ldap_serv, $ldap_port);
ldap_set_option($lc, LDAP_OPT_REFERRALS, 0);
ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, 3);
$ldapbind = ldap_bind($lc,$user,$pass);
if ($ldapbind == false) {
  echo 'username or password is wrong';
}
else
{
echo "You Logged in";
echo "<br><br><br>Wellcome<br><br><br>";
}
?>

Answer 1:

PHP LDAP扩展需要使用LDAP功能。 只是检查它在你的php.ini注释去掉,( extension=php_ldap.dll



Answer 2:

PHP扩展显然是不加载。 几件事情要尝试:

  • 在命令行中运行“PHP -m”,并确保LDAP是在模块列表,并没有涉及到LDAP错误。
  • 确保Apache的PHP模块使用您修改php.ini中(和寻找php.ini中的页面上)


文章来源: LDAP Authentication on Windows