windows10 apache2.4 + php5.6配置 curl扩展无法加载的解决方法
  • 2018-10-25发布
  • 2018-10-25修改

php_curl.dll和libssh2.dll无法加载的问题,把D:\servers\php5.6添加到系统变量Path即可。




如果问题还没 解决,可能是libssh2.dll的问题,试试下面的方法:


服务器上最普通的Apache 2.4+PHP5.6,不支持curl,报告没有curl_init函数;而php.ini里面已经打开了php_curl.dll,而且php -i的输出是正常的,说明curl是可以执行的。


最后我把php5.6、apache2.4以及对应的svn_mod,都升级到最新,仍然不好用,但是error.log报错了:


PHP Warning:  PHP Startup: Unable to load dynamic library 'D:/services/web/php56/ext/php_curl.dll' - \xef\xbf\xbd\xd2\xb2\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xd6\xb8\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xc4\xb3\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\r\n in Unknown on line 0


按照老规矩转换为byte[]然后输出字符串发现是乱码...各种码都白搭,怎么也转不出来,心好累。


后来google了一下,发现


http://stackoverflow.com/questions/16424117/php-unable-to-load-php-curl-dll-extension


的说法:


=====================


Make sure to have your apache SSH dlls loading correctly. On a fresh install I had to download and load into my apache bin directory the following dll "libssh2.dll"


After ssl dll was loaded cURL was able to load with no issues.


You can download it from the link below:


http://windows.php.net/downloads/pecl/releases/ssh2/0.12/


=====================


下载php_ssh2-0.12-5.5-ts-vc11-x64.zip,复制php_ssh2.dll到php目录的ext目录下,复制libssh2.dll到php目录的lib下,再启动apache,curl正常工作!