Windows 上的 Apache 找不到 php 扩展

Apache on Windows cant find php extensions

我在 Windows Server 2012 上安装了 Apache 2.4 和 php。

我正在尝试加载 php_ldap.dll 扩展。

这是我所做的:

php.ini中我设置如下:

extension_dir = "C:\php\ext"

extension=php_ldap.dll

然后,我确保 dll 在那个路径上可用,是的,它就在那里:

phpinfo 表明我正在编辑正确的 php.ini 并且 extension_dir 已更新。

但是,当我启动 Apache 时,php_ldap.dll 没有加载。

Apache 日志显示此警告:

PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\php\ext\php_ldap.dll' - The specified module could not be found.\r\n in Unknown on line 0

我该如何解决这个问题?

另外,\ 是怎么回事?为什么它加倍了“\”,这是问题所在吗?

我最好的猜测是您的系统缺少所需的库。 php_ldap 扩展要求系统上同时安装 libeay32.dllssleay32.dll

来自ldap installation manual

Note: Note to Win32 Users

In order for this extension to work, there are DLL files that must be available to the Windows system PATH. For information on how to do this, see the FAQ entitled "How do I add my PHP directory to the PATH on Windows". Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the system's PATH), this is not recommended. This extension requires the following files to be in the PATH: libeay32.dll and ssleay32.dll Versions before PHP 4.3.0 additionally require libsasl.dll.

不要在 php.ini !

中使用反斜杠

即使在 Windows 系统上,也始终在 php.ini 中使用斜杠。

extension_dir = "C:/php/ext"

extension=php_ldap.dll