我已经使用这个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 ?


当前回答

尝试一下,如果你得到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

其他回答

安装php70w-common。

提供了php-api、php-bz2、php-calendar、php-ctype、php-curl、php-date、php-exif、php-fileinfo、php-filter、php-ftp、php-gettext、php-gmp、php-hash、php-iconv、php-json、php-libxml、php-openssl、php-pcre、php-pecl-Fileinfo、php-pecl-phar、php-pecl-zip、php-reflection、php-session、php-shmop、php-simplexml、php-sockets、php-spl、php-tokenizer、php-zend-abi、php-zip、php-zlib。

https://webtatic.com/packages/php70/

好吧,我可以安装它:

sudo apt-get install php-curl

在我的系统上。这将安装一个依赖包,依赖于默认的php版本。

然后重启apache

sudo service apache2 restart
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

如果“sudo apt-get install php-curl”命令不起作用,提示错误 我们应该在安装curl之前运行这段代码。

步骤1 - sudo添加-apt-repository ppa:ondrej/php 步骤2 - sudo apt-get更新 步骤3 - sudo apt-get安装php-curl 步骤4 - sudo服务apache2重启