我已经使用这个repo安装了PHP 7,但是当我尝试运行composer install时,它给出了这个错误:

[package] require ext-curl * ->系统中缺少所请求的PHP扩展curl。

使用PHP 5,您可以通过运行yum或apt-get install php5-curl命令轻松安装它,但我找不到如何安装PHP 7的等效程序。

如何为PHP 7安装ext-curl ?


当前回答

sudo apt-get install php7.0-curl

其他回答

尝试一下,如果你得到E:无法定位包{packageName}

sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php-curl

如果你正在使用PHP7.1(尝试php -version找到你的php版本)

sudo apt-get install php7.1-curl

然后重新启动apache

sudo service apache2 restart

首先登录到你的服务器,检查你的服务器上安装的PHP版本。

然后执行如下命令:

sudo apt-get install php7.2-curl

sudo service apache2 restart

将PHP版本(php7.2)替换为您的PHP版本。

我们可以安装任何PHP7扩展,我们需要在安装Magento时,只需使用相关的命令,你会在安装Magento时得到错误

sudo apt-get install php7.0-curl
sudo apt-get install php7.0-dom
sudo apt-get install php7.0-mcrypt
sudo apt-get install php7.0-simplexml
sudo apt-get install php7.0-spl
sudo apt-get install php7.0-xsl
sudo apt-get install php7.0-intl
sudo apt-get install php7.0-mbstring
sudo apt-get install php7.0-ctype
sudo apt-get install php7.0-hash
sudo apt-get install php7.0-openssl
sudo apt-get install php7.0-zip
sudo apt-get install php7.0-xmlwriter
sudo apt-get install php7.0-gd
sudo apt-get install php7.0-iconv
sudo apt-get install php7.0-curl