如何使用PHP 7安装ext-curl扩展?
我使用这个repo安装了PHP 7,但是当我尝试运行composer install时,它给出了这个错误:
[包]需要ext-curl * - > 系统中缺少所请求的PHP扩展curl。
使用PHP 5,您可以通过运行yum或apt-get install php5-curl命令轻松安装它,但我找不到如何安装PHP 7等效项。
如何为PHP 7安装ext-curl?
7个解决方案
330 votes
好吧,我能够通过以下方式安装它:
sudo apt-get install php-curl
在我的系统上。 这将安装依赖包,这取决于默认的PHP版本。
之后重启apache
sudo service apache2 restart
Sabeeh Chaudhry answered 2019-05-25T17:47:59Z
83 votes
请试试
sudo apt-get install php7.0-curl
jk2K answered 2019-05-25T17:48:25Z
18 votes
如果“sudo apt-get install php-curl”命令不起作用并显示错误我们应该在安装curl之前运行这段代码。
step1 - sudo add-apt-repository ppa:ondrej / php
step2 - sudo apt-get update
step3 - sudo apt-get install php-curl
step4 - sudo service apache2 restart
Bijaya Kumar Oli answered 2019-05-25T17:49:17Z
9 votes
我们可以在安装时安装我们需要的任何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
谢谢! 希望对你有帮助
Narendra Solanki answered 2019-05-25T17:49:50Z
7 votes
我尝试了上面的解决方案,但它对我不起作用,只是让任何其他人穿着同样的鞋子,这就是我所做的。我使用以下命令更新了apt-get
sudo add-apt-repository ppa:ondrej/php
这个我用php curl安装我正在使用的php版本,我的
sudo apt-get install php7.1-curl
Excellent Lawrence answered 2019-05-25T17:50:26Z
1 votes
安装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/]
CiaranSynnott answered 2019-05-25T17:51:06Z
-2 votes
如果你得到E: Unable to locate package {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
Liao San Kai answered 2019-05-25T17:51:31Z