加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – Windows上的LDAP身份验证

发布时间:2020-12-13 17:21:59 所属栏目:PHP教程 来源:网络整理
导读:我安装了64位 Windows平台和Postgresql 8.4(因为Apache,EnterpriseDB-Apache PHP安装在Pstgres上)..我需要使用Active Directory(或LDAP?)凭据对系统进行身份验证,但即使很难我启用LDAP并重新启动Apache错误日志我看到PHP致命错误:在path / to / my / phpfi
我安装了64位 Windows平台和Postgresql 8.4(因为Apache,EnterpriseDB-Apache PHP安装在Pstgres上)..我需要使用Active Directory(或LDAP?)凭据对系统进行身份验证,但即使很难我启用LDAP并重新启动Apache错误日志我看到PHP致命错误:在path / to / my / phpfile中调用未定义函数ldap_connect().我使用的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>";
}
?>

解决方法

使用LDAP功能需要PHP LDAP扩展.只需在php.ini中检查它是否已取消注释(extension = php_ldap.dll)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读