Apache 2.4.23 PHP7.x Windows 10 x64 php_curl 不工作 [英] Apache 2.4.23 PHP7.x Windows 10 x64 php_curl not working
问题描述
我试图将我的服务器升级到最新的 Apache 2.4.23 和 PHP 7.1,但无法加载 php_curl 库,不知道为什么.
I was trying to upgrade my server to latest Apache 2.4.23 and PHP 7.1 but it fail to load php_curl library, don't know why.
PHP Warning: PHP Startup: Unable to load dynamic library 'ext\php_curl.dll' - The specified procedure could not be found.
in Unknown on line 0
我已经尝试过以下
- 将扩展路径更改为完整路径,如 d:webserverphpext
- 将
php_curl.dll、libssh2.dll、libeay32.dll、ssleay32.dll
复制到System32、php/ext、apache/bin、php - 添加了php路径系统变量
- PHP7 和 PHP7.1 都试过了
- 所有这些都是 x64 和所有其他扩展成功加载和服务器工作,但只有 php_curl 不工作
- php.ini 中未注释的扩展
<小时>
- Apache 2.4.23 x64
- PHP7 并尝试过 PHP7.1(线程安全)x64
- Windows 10 x64
推荐答案
解决方案:将 libeay32.dll、libssh2.dll、ssleay32.dll 文件放在 httpd.conf 的 ServerRoot 指令中指定的目录下.这些 dll 可以在 php 根文件夹下找到.
Solution: Put libeay32.dll, libssh2.dll, ssleay32.dll files under dir specified in httpd.conf's ServerRoot directive. These dlls can be found compiled under php root folder.
原因:
问题是 php_curl.dll 需要在加载时访问以下库:libeay32.dll、libssh2.dll、ssleay32.dll,如果你把它们放在 ./php/ext 目录或如果你把 php 扩展名,这没有意义在 php 根目录中.
Problem is php_curl.dll requires to access following libraries while loading: libeay32.dll, libssh2.dll, ssleay32.dll and it does not make sense if you put them in ./php/ext dir or if you put php extensions in php root dir.
当然,您可以将它们放在 c:Windows 或 PATH 中定义的某个全局文件夹中,但是如果您不想这样做并且希望您的 apache+php 安装是可移植的:
Of course you can put them in c:Windows or in some global folder defined in PATH but if you dont want to do this and you want that your apache+php installation was portable:
httpd.conf 中 ServerRoot 中指定的路径被视为 php 的 home 路径.该行为类似于您在 ./index.php 中包含 ./path/to/some.php 文件并且 some.php 文件的主路径仍然是 ./index.php 所在的目录的情况.
The path specified in ServerRoot in httpd.conf is treated as home path for php. The behaviour is similar to situation where you include ./path/to/some.php file in ./index.php and home path for some.php file is still ./ the dir where index.php resides.
简而言之,只需将这三个 dll 放在您在 httpd.conf ServerRoot 指令中指定的目录中,php_curl.dll 将不会再次加载失败.
In shorts just put those three dlls right in dir you specified in httpd.conf ServerRoot directive and php_curl.dll will not fail to load again.
这篇关于Apache 2.4.23 PHP7.x Windows 10 x64 php_curl 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!