如何在 PHP / XAMPP 中启用 cURL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1347146/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to enable cURL in PHP / XAMPP
提问by Fero
How do I enable cURL in PHP?
如何在 PHP 中启用 cURL?
??
??
采纳答案by Jon Benedicto
Since you're using XAMPP, uncomment the line
由于您使用的是 XAMPP,请取消注释该行
;extension=php_curl.dll
in xampp\apache\bin\php.ini, and then restart the Apache service.
中xampp\apache\bin\php.ini,然后重启Apache服务。
NB: In newer XAMPP versions, PHP has moved to root xampp folder xampp\php\php.ini.
注意:在较新的 XAMPP 版本中,PHP 已移至根 xampp 文件夹xampp\php\php.ini。
回答by Phil
回答by WaiKit Kung
Steps for Windows 7:
Windows 7 的步骤:
- Ensure that the php.ini file that the PHP engine uses is the one you think it is.
- Ensure extension_dir in php.ini is correctly set to the ext folder
- Ensure
extension=php_curl.dllin the php.ini is uncommented
- 确保 PHP 引擎使用的 php.ini 文件是您认为的那个文件。
- 确保 php.ini 中的 extension_dir 正确设置为 ext 文件夹
- 确保
extension=php_curl.dll在 php.ini 中没有注释
Finally and maybe the one most people don't know:
4. Ensure that there are these two files in the Windows System32 folder:
libeay32.dll
ssleay32.dll
If not there, you may copy these two files from the phpfolder.
最后,也许大多数人不知道: 4. 确保 Windows System32 文件夹中有这两个文件: libeay32.dll ssleay32.dll 如果没有,您可以从php文件夹中复制这两个文件。
回答by webDevAndEverythingElse
I found the file located at:
我找到了位于以下位置的文件:
C:\xampp\php\php.ini
Uncommented:
未注释:
;extension=php_curl.dll
回答by Martin Thoma
For Ubuntu (and probably all Debian-Based) Linux Distributions:
对于 Ubuntu(可能还有所有基于 Debian 的)Linux 发行版:
sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart
You might have seen PHP Fatal error: Call to undefined function curl_init()before.
你PHP Fatal error: Call to undefined function curl_init()以前可能见过。
回答by David Mulder
回答by chaos
回答by Krishna
Basic tip: After enabling the CURL in php.ini file, you need to restart the web server to make it work (my experience says).
基本提示:在 php.ini 文件中启用 CURL 后,您需要重新启动 Web 服务器才能使其工作(我的经验说)。
回答by wardprod
Since XAMPP went through some modifications, the file is now at xampp/php/php.ini.
由于 XAMPP 经历了一些修改,该文件现在位于xampp/php/php.ini.
回答by Santo Boldi?ar
PHP 7^ version:
PHP 7^ 版本:
sudo apt-get install php-curl
sudo service apache2 restart

