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.\r\n in Unknown on line 0
我尝试了以下操作
- 将扩展路径更改为完整路径,例如d:\webserver\php\ext
- 复制
php_curl.dll,libssh2.dll,libeay32.dll ,ssleay32.dll
到 System32 , php / ext , apache / bin , php - 添加了php路径系统变量
- 已经尝试了PHP7和PHP7.1
- 所有这些是x64,并且所有其他扩展名均已成功加载并且服务器可以正常工作,但只有php_curl无法正常工作
-
php.ini中的未注释扩展名
- Change extension path to full path like d:\webserver\php\ext
- Copy
php_curl.dll, libssh2.dll, libeay32.dll, ssleay32.dll
to System32, php/ext, apache/bin, php - Added php path system variable
- Have tried both PHP7 and PHP7.1
- All of these are x64 and all other extension loaded successfully and server working but only php_curl is not working
- uncommented extension in php.ini
- Apache 2.4.23 x64
- PHP7,也尝试使用PHP7.1(线程安全)x64
- Windows 10 x64
推荐答案
解决方案:将libeay32.dll,libssh2.dll,ssleay32.dll文件放在httpd.conf的ServerRoot指令中指定的dir下。这些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的本地路径。行为类似于在./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指令中指定的dir中,并且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屋!