LDAP Authentication on Windows(Windows 上的 LDAP 身份验证)
问题描述
我安装了 64 位 Windows 平台和 Postgresql 8.4(作为 Apache,EnterpriseDB-ApachePHP 安装在 Pstgres 上).我需要使用 Active Directory(或 LDAP?)凭据对系统进行身份验证,但即使我启用了 LDAP 和在 error 日志上重新启动 Apache 我看到 PHP 致命错误:在 path/to/my/phpfile 中调用未定义函数 ldap_connect().. PHP我使用的脚本如下,
i have an 64 bit Windows Platform and Postgresql 8.4 installed(as Apache, EnterpriseDB-ApachePHP is installed on Pstgres).. I need to authenticate to system using Active Directory(or LDAP?) credentials but even tough i enabled LDAP and restarted Apache on error log i see PHP Fatal error: Call to undefined function ldap_connect() in path/to/my/phpfile.. PHP script i use is below,
<?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>";
}
?>
推荐答案
使用 LDAP 函数需要 PHP LDAP 扩展.只需检查它在您的 php.ini (extension=php_ldap.dll
) 中是否未注释即可
The PHP LDAP extension is required to use LDAP functions. Just check it's uncommented in your php.ini (extension=php_ldap.dll
)
这篇关于Windows 上的 LDAP 身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Windows 上的 LDAP 身份验证


基础教程推荐
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的PDF导出 2022-01-01
- php中的foreach复选框POST 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- Web 服务器如何处理请求? 2021-01-01