如何在 Ubuntu 16.04 中安装 php-curl

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

How to install php-curl in Ubuntu 16.04

phpubuntucurlubuntu-16.04php-curl

提问by Govind Samrow

Upgraded to Ubuntu 16.04and facing problem after installing PHP5.

升级到Ubuntu 16.04安装后遇到问题PHP5

Installed PHP-5 with following:

安装 PHP-5 如下:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5.5   # for PHP 5.5

Trying to install php-curl but its not working.

尝试安装 php-curl 但它不起作用。

sudo apt-get install php5-curl

Error: E: Unable to locate package php5-curl

错误:E:无法定位包 php5-curl

回答by Govind Samrow

In Ubuntu 16.04 default PHP version is 7.0, if you want to use different version then you need to install PHP package according to PHP version:

在 Ubuntu 16.04 中默认 PHP 版本是 7.0,如果你想使用不同的版本,那么你需要根据 PHP 版本安装 PHP 包:

  • PHP 7.4: sudo apt-get install php7.4-curl
  • PHP 7.3: sudo apt-get install php7.3-curl
  • PHP 7.2: sudo apt-get install php7.2-curl
  • PHP 7.1: sudo apt-get install php7.1-curl
  • PHP 7.0: sudo apt-get install php7.0-curl
  • PHP 5.6: sudo apt-get install php5.6-curl
  • PHP 5.5: sudo apt-get install php5.5-curl
  • PHP 7.4: sudo apt-get install php7.4-curl
  • PHP 7.3: sudo apt-get install php7.3-curl
  • PHP 7.2: sudo apt-get install php7.2-curl
  • PHP 7.1: sudo apt-get install php7.1-curl
  • PHP 7.0: sudo apt-get install php7.0-curl
  • PHP 5.6: sudo apt-get install php5.6-curl
  • PHP 5.5: sudo apt-get install php5.5-curl

回答by Aaganja

This worked for me.

这对我有用。

sudo apt-get install php-curl

回答by Nehal J Wani

This works for me:

这对我有用:

sudo apt-get install php5.6-curl

回答by Guillermo Hernández

Do:

做:

apt-get update

And then:

进而:

apt-get install php5-curl

回答by Yaser AlAzem

For Ubuntu 18.04 or PHP 7.2 users you can do:

对于 Ubuntu 18.04 或 PHP 7.2 用户,您可以执行以下操作:

apt-get install php7.2-curl

apt-get install php7.2-curl

You can check your PHP version by running php -vto verify your PHP version and get the right curl version.

您可以通过运行php -v来检查您的 PHP 版本以验证您的 PHP 版本并获得正确的 curl 版本。

回答by Khalid Bin Huda

To Install cURL 7.49.0 on Ubuntu 16.04 and Derivatives

在 Ubuntu 16.04 和衍生版本上安装 cURL 7.49.0

wget http://curl.haxx.se/download/curl-7.49.0.tar.gz
tar -xvf curl-7.49.0.tar.gz
cd curl-7.49.0/
./configure
make
sudo make install

回答by Linuxian

sudo apt-get install php5.6-curl

and restart the web browser.

并重新启动网络浏览器。

You can check the modules by running php -m | grep curl

您可以通过运行检查模块 php -m | grep curl