首页 文章

如何使用PHP 7安装ext-curl扩展?

提问于
浏览
148

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

[package]需要ext-curl * - >系统中缺少所请求的PHP扩展卷曲 .

使用PHP 5,您可以通过运行 yumapt-get install php5-curl 命令轻松安装它,但我找不到如何安装PHP 7等效命令 .

如何为PHP 7安装ext-curl?

8 回答

  • -2

    好吧,我能够通过以下方式安装它:

    sudo apt-get install php-curl
    

    在我的系统上 . 这将安装依赖包,这取决于默认的PHP版本 .

    之后重启apache

    sudo service apache2 restart
    
  • 1

    请试试

    sudo apt-get install php7.0-curl
    
  • 352

    如果“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

  • 87

    我尝试了上面的解决方案,但它对我不起作用,只是让任何其他人穿着同样的鞋子,这就是我所做的 . 我使用以下命令更新了apt-get

    sudo add-apt-repository ppa:ondrej/php
    

    这个我用php curl安装我正在使用的php版本,我的

    sudo apt-get install php7.1-curl
    
  • 19

    我们可以在安装时安装我们需要的任何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
    

    谢谢!希望对你有帮助

  • 12

    安装 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/

  • 1

    如果您使用的是PHP7.1(请尝试使用 php -version 查找您的PHP版本)

    sudo apt-get install php7.1-curl
    

    然后重启apache

    sudo service apache2 restart
    
  • 9

    如果你得到 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
    

相关问题