How to install php-curl in Ubuntu 16.04

242,870

Solution 1

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:

  • 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

Solution 2

This worked for me.

sudo apt-get install php-curl

Solution 3

This works for me:

sudo apt-get install php5.6-curl

Solution 4

Do:

apt-get update

And then:

apt-get install php5-curl

Solution 5

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php8.0-curl
Share:
242,870

Related videos on Youtube

Govind Samrow
Author by

Govind Samrow

I’m software engineer. I've complete my post graduation from Punjabi university, Patiala. I love my family, my state (Punjab) and my country. I'm son of Farmer ,I'm from village Arakwas, dist. sangrur and now in Chandighar.

Updated on March 13, 2021

Comments

  • Govind Samrow
    Govind Samrow about 3 years

    Upgraded to Ubuntu 16.04 and facing problem after installing PHP5.

    Installed PHP-5 with following:

    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.

    sudo apt-get install php5-curl
    

    Error: E: Unable to locate package php5-curl

    • I wrestled a bear once.
      I wrestled a bear once. over 7 years
      are you sure it's not installedand not just disabled? use php5enmod command to enable it.
    • Blue
      Blue over 7 years
      Is there a reason why you need to use php 5.5? It's reached it's end of life, and is no longer supported (There are many security issues)
    • Govind Samrow
      Govind Samrow over 7 years
      @frankerZ My projects not working under PHP7
    • Blue
      Blue over 7 years
      Are these huge projects? I think you should lean toward making your projects work in the latest version, then installing an old php to support this project.
    • Govind Samrow
      Govind Samrow over 7 years
      I've 15-20 projects on local and live servers not in my hand
  • Yankee
    Yankee over 7 years
    Yes, this works without having to specify a PHP version if the user doesn't know it.
  • Riz
    Riz about 7 years
    Worked for me too on Amazon EC2 Ubuntu 16
  • ShadowZzz
    ShadowZzz over 6 years
    For me, this was exactly the case. Had PHP 7 installed and kept getting Package 'php5-curl' has no installation candidate. Running sudo apt-get install php-curl fixed the problem
  • Davinder Kumar
    Davinder Kumar over 6 years
    yeah, it Works.
  • little tiny man
    little tiny man over 6 years
    use php -version to find out what version of PHP you're on
  • GTodorov
    GTodorov over 5 years
    Perfect, but how do you fix libcurl issues with PHP 7.2 (needs libcurl4) and Percona MySQL 5.7 (needs libcurl3)?
  • Juyal Jee
    Juyal Jee over 5 years
    @ShadowZzz yes, your suggestion worked for me as well.
  • Jakob Alexander Eichler
    Jakob Alexander Eichler over 5 years
    It seems, that these versions are no longer part of ubuntu 18.10
  • elfTine
    elfTine over 5 years
    Hey, Thanks a lot!! You save me :)