即使我编辑了 php.ini 并且 php_ldap.dll 位于正确的位置,仍无法启用 PHP LDAP?
我已经使用 WAMP 安装有一段时间了,现在启用了 LDAP,一切都很顺利。现在,虽然我必须设置另一台机器,但由于某种原因我无法启用 LDAP。
我检查了 phpinfo()
的输出,但 LDAP 部分不存在。我编辑了 php.ini 来取消注释该行:
extension = php_ldap.dll
我还检查了正在搜索扩展名的文件路径,并且文件 php_ldap.dll 位于正确的位置。
我肯定我正在编辑正确的php.ini
文件,因为我检查了phpinfo()
显示的文件路径,而且我我能够成功启用/禁用其他扩展。
每次更改后我都会重新启动 Apache。
在谷歌搜索时,我找到的唯一解决方案就是上面的解决方案,再加上一两次提到编辑 Windows PATH
变量以包含 php.ini
的路径?尝试了一下,尽管它对我来说没有意义(因为我已经知道 php.ini
正在被解析)。我还检查了我之前在另一台计算机上的安装,从我所看到的情况来看,我从未将任何 PHP 目录添加到该计算机上的 PATH
编辑完整答案
弗兰克的答案下面引导我找到了解决方案,所以我想我现在会整合一切。
要在 WAMP 服务器上启用 LDAP 支持:
- 取消注释
php.ini
中的extension = php_ldap.dll
- 重要:确保您正在编辑通过检查
phpinfo()
的输出来正确检查php.ini
- 检查
php.ini
文件中扩展目录的位置 - 检查
php_ldap.dll
位于该目录中 - (我错过的一步)找到文件
libeay32.dll
和ssleay32.dll
并将其目录添加到 Windows PATH - 重新启动阿帕奇。如果启用了 LDAP,
phpinfo()
的输出中将会有一个关于它的部分
I've been working with a WAMP install for quite a while now with LDAP enabled and everything is going smoothly. Now though I have to set up another machine and for some reason I can't enable LDAP.
I checked the output of phpinfo()
and the LDAP section isn't there. I edited php.ini
to uncomment the line:
extension = php_ldap.dll
I also checked the filepath being searched for extensions and the file php_ldap.dll
is in the right place.
I'm positive I'm editing the right php.ini
file since I checked the filepath being shown by phpinfo()
, and also I am able to successfully enable/disable other extensions.
I have rebooted Apache after every change made.
While Googling this, the only solutions I found were those above, plus one or two mentions of editing the Windows PATH
variable to include the path to php.ini
? Tried it even though it didn't make sense to me (as I already know php.ini
is being parsed). I also checked my previous install on the other machine and from what I can see I never added any PHP directories to the PATH
on that machine
Edit with complete answer
Frank's answer below led me to the solution so I thought I'd consolidate everything now.
To Enable LDAP Support on a WAMP server:
- Uncomment
extension = php_ldap.dll
inphp.ini
- IMPORTANT: Make sure that you're editing the right
php.ini
by checking the output ofphpinfo()
- Check the
php.ini
file for the location of your extensions directory - Check that
php_ldap.dll
is located in that directory - (THE STEP I MISSED) Find the files
libeay32.dll
andssleay32.dll
and add their directory to the Windows PATH - Reboot Apache. If LDAP is enabled there will be a section about it in the output of
phpinfo()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这里有一些提示:http://php.net/manual/en/ldap。安装.php 。请注意,您需要添加另外两个 DLL
libeay32.dll
和ssleay32.dll
。您可能还需要使用--with-ldap
进行编译There are a few hints here: http://php.net/manual/en/ldap.installation.php . Note you need to add two other DLLs
libeay32.dll
andssleay32.dll
. You may also need to compile with--with-ldap
我按照这些说明进行操作,但仍然无法在我的 phpinfo() 中加载 LDAP。 Apache 日志在启动时显示以下非致命消息:
######/php5.4.16/ext/php_ldap.dll - 找不到指定的模块。在 Unknown on line 0
最后,我再次查看 phpinfo() ,发现正在使用系统变量 PATH 而不是我的用户变量 PATH,并且它不包含 PHP 根目录和 PHP 根目录的正确路径扩展文件夹。只需将它们添加到
####\php\php5.4.16;####\php\php5.4.16\ext;
中并重新启动 Apache,即可解决问题。希望这可以帮助其他人。I followed these instructions but still couldn't get LDAP loading in my phpinfo(). The Apache logs showed on startup the following non-fatal message:
######/php5.4.16/ext/php_ldap.dll - The specified module could not be found. in Unknown on line 0
In the end, I looked at phpinfo() again and saw that the system variable PATH was being used instead of my user variable PATH and it didn't contain the correct path to PHP's root and PHP's extension folder. Simply adding them in
####\php\php5.4.16;####\php\php5.4.16\ext;
and restarting Apache, solved the problem. Hope this can help someone else out.我的环境
Windows 10
PHP 7.4.3
阿帕奇2.4.41
My environment
Windows 10
PHP 7.4.3
Apache 2.4.41
我正在使用 phpstorm。如果找不到注释,只需将“extension = php_ldap.dll”粘贴到 php.ini 页面的底部即可。不客气
im using phpstorm. if you cant find the comment, just paste"extension = php_ldap.dll" at the bottom of your php.ini page. you are welcome