Windows 10 Pro上突然不加载PHP cURL [英] PHP cURL suddenly not loading on Windows 10 Pro

查看:148
本文介绍了Windows 10 Pro上突然不加载PHP cURL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个简单的(在此示例中为 /etc/php/7.0 /fpm/php.ini ),然后编辑该php.ini文件(如果该文件实际上具有 extension = C:\php7\ext\php_curl.dll) 行,则以下设置的某些组合设置错误:



display_startup_errors 关闭,将其更改为打开



display_errors Off ,将其更改为 On



error_reporting 不是 E_ALL ,更改到 error_reporting = E_ALL (没有别的,不像 error_reporting = E_ALL& 〜E_NOTICE 或其他,仅是E_ALL)



html_errors 关闭,将其更改为打开



然后重新启动apache,再次检查phpinfo ()页面,并验证是否确实加载了新的配置选项,然后运行<?php curl_init(); ,它应该显示有关为什么curl扩展的错误无法加载。


A simple php_curl example isn't working anymore on my Windows 10 laptop. It was working before.

Fatal error: Uncaught Error: Call to undefined function curl_init() in C:\Users\path\curl.php:3 Stack trace: #0 {main} thrown in C:\Users\path\curl.php on line 3

My C:\php7\php.ini has extension=C:\php7\ext\php_curl.dll
php_curl.dll exists in C:\php7\ext

PHP Version 7.0.30
Windows 10 Pro Version 1607 Build 14393.2189

But my loclahost/phpinfo.php does not have cURL. How come all of a sudden it disappeared ?

PS : The script worked in the command line. It's just that Apache is not loading the extension.

解决方案

don't know why it suddenly stopped working, but first run <?php phpinfo(~0); , and check which php.ini file that is actually loaded (this avoids editing the wrong php.ini file to no avail) (in this example, it is /etc/php/7.0/fpm/php.ini), then edit that php.ini file, if that file actually has the extension=C:\php7\ext\php_curl.dll line, then some combination of the following settings are set wrong:

display_startup_errors is Off, change it to On

display_errors is Off, change it to On

error_reporting is not E_ALL, change it to error_reporting=E_ALL (and nothing else, not like error_reporting= E_ALL & ~E_NOTICE or whatever, just E_ALL)

html_errors is Off, change it to On

then restart apache, again check the phpinfo() page, and verify that the new configuration options are actually loaded, then run <?php curl_init();, and it should show an error about why the curl extension could not be loaded.

这篇关于Windows 10 Pro上突然不加载PHP cURL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆