即使我编辑了 php.ini 并且 php_ldap.dll 位于正确的位置,也无法启用 PHP LDAP?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8826379/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to enable PHP LDAP even though I have edited php.ini and php_ldap.dll is in the right place?
提问by Ciaran Phillips
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.
我已经使用 WAMP 安装工作了很长一段时间,并且启用了 LDAP,一切都进行得很顺利。现在虽然我必须设置另一台机器,但由于某种原因我无法启用 LDAP。
I checked the output of phpinfo()
and the LDAP section isn't there. I edited php.ini
to uncomment the line:
我检查了phpinfo()
LDAP 部分的输出。我编辑php.ini
取消注释该行:
extension = php_ldap.dll
I also checked the filepath being searched for extensions and the file php_ldap.dll
is in the right place.
我还检查了正在搜索扩展名的文件路径,并且该文件php_ldap.dll
位于正确的位置。
I'm positiveI'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.
我正我编辑了正确的php.ini
文件,因为我查过被这些文件路径phpinfo()
,并且还我能够成功地启用/禁用其他扩展。
I have rebooted Apache after every change made.
每次更改后我都重新启动了 Apache。
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
在谷歌搜索时,我找到的唯一解决方案是上面的那些,加上一两次提到编辑 WindowsPATH
变量以包含到php.ini
? 即使它对我没有意义也尝试过(因为我已经知道php.ini
正在解析)。我还检查了我之前在另一台机器上的安装,从我所看到的,我从未PATH
在该机器上添加任何 PHP 目录
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:
在 WAMP 服务器上启用 LDAP 支持:
- 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()
- 取消注释
extension = php_ldap.dll
中php.ini
- 重要提示:
php.ini
通过检查输出确保您正在编辑正确的phpinfo()
- 检查
php.ini
文件以获取扩展目录的位置 - 检查
php_ldap.dll
是否位于该目录中 - (I工序未接)找到文件
libeay32.dll
,并ssleay32.dll
和其目录添加到Windows PATH - 重启阿帕奇。如果启用了 LDAP,则在输出中会有一个关于它的部分
phpinfo()
采纳答案by Frank Farmer
There are a few hints here: http://php.net/manual/en/ldap.installation.php. Note you need to add two other DLLs libeay32.dll
and ssleay32.dll
. You may also need to compile with --with-ldap
这里有一些提示:http: //php.net/manual/en/ldap.installation.php。请注意,您需要添加另外两个 DLLlibeay32.dll
和ssleay32.dll
. 您可能还需要编译--with-ldap
回答by alexkb
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
我遵循了这些说明,但仍然无法在我的 phpinfo() 中加载 LDAP。Apache 日志在启动时显示以下非致命消息:######/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.
最后,我再次查看了 phpinfo(),发现使用的是系统变量 PATH 而不是我的用户变量 PATH,并且它没有包含到 PHP 根目录和 PHP 扩展文件夹的正确路径。只需将它们添加####\php\php5.4.16;####\php\php5.4.16\ext;
并重新启动Apache,即可解决问题。希望这可以帮助别人。
回答by Meow Kim
- Check out libsasl.dlllibeay32.dll, ssleay32.dllin your PHP folder
- If libeay32.dll, ssleay32.dllare not there, download it from https://code.google.com/archive/p/openssl-for-windows/downloads
- Copy them to System32folder in Windows
- Now you can see LDAP section on you phpinfo(). it worked for me.
- 查看PHP 文件夹中的libsasl.dll libeay32.dll、ssleay32.dll
- 如果libeay32.dll、ssleay32.dll不存在,请从https://code.google.com/archive/p/openssl-for-windows/downloads下载
- 将它们复制到Windows 中的System32文件夹
- 现在您可以在phpinfo()上看到 LDAP 部分。它对我有用。
My environment
Windows 10
PHP 7.4.3
Apache 2.4.41
我的环境
Windows 10
PHP 7.4.3
Apache 2.4.41
回答by process
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
我正在使用 phpstorm。如果找不到评论,只需在 php.ini 页面底部粘贴“extension = php_ldap.dll”即可。不客气