php – Windows上的LDAP身份验证

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – Windows上的LDAP身份验证脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我安装了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)
@H_502_19@

脚本宝典总结

以上是脚本宝典为你收集整理的php – Windows上的LDAP身份验证全部内容,希望文章能够帮你解决php – Windows上的LDAP身份验证所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。