即使我编辑了 php.ini 并且 php_ldap.dll 在正确的位置,也无法启用 PHP LDAP?

2022-01-17 00:00:00 wamp ldap php apache

在启用 LDAP 的情况下,我已经使用 WAMP 安装了很长一段时间,并且一切进展顺利.现在虽然我必须设置另一台机器,但由于某种原因我无法启用 LDAP.

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.

我检查了 phpinfo() 的输出,但 LDAP 部分不存在.我编辑了 php.ini 以取消注释该行:

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

我还检查了正在搜索扩展的文件路径,文件 php_ldap.dll 位于正确的位置.

I also checked the filepath being searched for extensions and the file php_ldap.dll is in the right place.

我肯定我正在编辑正确的 php.ini 文件,因为我检查了 phpinfo() 显示的文件路径,而且我还能够成功启用/禁用其他扩展.

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.

每次更改后我都重新启动了 Apache.

I have rebooted Apache after every change made.

在谷歌搜索时,我发现的唯一解决方案是上面的那些,加上一两次提到编辑 Windows PATH 变量以包含 php.ini 的路径?即使它对我没有意义也尝试过(因为我已经知道 php.ini 正在被解析).我还检查了我之前在另一台机器上的安装,从我所见,我从未在该机器上的 PATH 中添加任何 PHP 目录

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

Frank 下面的回答让我找到了解决方案,所以我想我现在应该整合所有内容.

Frank's answer below led me to the solution so I thought I'd consolidate everything now.

在 WAMP 服务器上启用 LDAP 支持:

To Enable LDAP Support on a WAMP server:

  1. php.ini
  2. 中取消注释 extension = php_ldap.dll
  3. 重要提示:通过检查 phpinfo()
  4. 的输出,确保您正在编辑正确的 php.ini
  5. 检查 php.ini 文件以了解您的扩展目录的位置
  6. 检查 php_ldap.dll 是否位于该目录中
  7. (我错过的步骤) 找到文件 libeay32.dllssleay32.dll 并将它们的目录添加到 Windows PATH李>
  8. 重新启动 Apache.如果启用了 LDAP,在 phpinfo()
  9. 的输出中会有一个关于它的部分
  1. Uncomment extension = php_ldap.dll in php.ini
  2. IMPORTANT: Make sure that you're editing the right php.ini by checking the output of phpinfo()
  3. Check the php.ini file for the location of your extensions directory
  4. Check that php_ldap.dll is located in that directory
  5. (THE STEP I MISSED) Find the files libeay32.dll and ssleay32.dll and add their directory to the Windows PATH
  6. Reboot Apache. If LDAP is enabled there will be a section about it in the output of phpinfo()

推荐答案

这里有一些提示:http://php.net/manual/en/ldap.installation.php.请注意,您需要添加另外两个 DLL libeay32.dllssleay32.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 and ssleay32.dll. You may also need to compile with --with-ldap

相关文章