如何为 php 启用 curl

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23233460/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:35:36  来源:igfitidea点击:

How do I enable curl for php

phpcurlnginxdebian

提问by user1446650

I'm using NGINX with PHP-FPM on Debian Wheezy via DotDeb repo.

我通过 DotDeb 存储库在 Debian Wheezy 上使用 NGINX 和 PHP-FPM。

This is the only curl reference in my php.ini file and I'm not sure what I need to do. Any help is appreciated (it's already installed)

这是我的 php.ini 文件中唯一的 curl 引用,我不确定我需要做什么。任何帮助表示赞赏(它已经安装)

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
;curl.cainfo =

; Local Variables:
; tab-width: 4
; End:

回答by Tan Hong Tat

Check whether you have php5-curlinstalled

检查你是否已经php5-curl安装

dpkg -l | grep 'php5-curl'

If isn't installed,

如果没有安装,

apt-get install php5-curl

Ensure the path in extension_direxists, and contains curl.so, if not, change to the correct path.

确保中的路径extension_dir存在,并且包含 curl.so,如果不存在,请更改为正确的路径。

php -i | grep extension_dir

Ensure the /etc/php5/mods-available/curl.iniexists and has the curl.so loaded

确保/etc/php5/mods-available/curl.ini存在并加载了 curl.so

; configuration for php CURL module
; priority=20
extension=curl.so

If everything is correct, restart PHP-FPM

如果一切正常,重启 PHP-FPM

/etc/init.d/php5-fpm restart

回答by Priyank

To enable curl uncomment

启用 curl 取消注释

;extension=php_curl.dll
to
extension=php_curl.dll