How to install php-curl in Ubuntu 16.04

PhpUbuntuCurlUbuntu 16.04Php Curl

Php Problem Overview


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

Php Solutions


Solution 1 - Php

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 - Php

This worked for me.

sudo apt-get install php-curl

Solution 3 - Php

This works for me:

sudo apt-get install php5.6-curl

Solution 4 - Php

Do:

apt-get update

And then:

apt-get install php5-curl

Solution 5 - Php

To Install cURL 7.49.0 on Ubuntu 16.04 and Derivatives

wget http://curl.haxx.se/download/curl-7.49.0.tar.gz
tar -xvf curl-7.49.0.tar.gz
cd curl-7.49.0/
./configure
make
sudo make install

Solution 6 - Php

For Ubuntu 18.04 or PHP 7.2 users you can do:

apt-get install php7.2-curl

You can check your PHP version by running php -v to verify your PHP version and get the right curl version.

Solution 7 - Php

sudo apt-get install php5.6-curl

and restart the web browser.

You can check the modules by running php -m | grep curl

Solution 8 - Php

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGovind SamrowView Question on Stackoverflow
Solution 1 - PhpGovind SamrowView Answer on Stackoverflow
Solution 2 - PhpAaganjaView Answer on Stackoverflow
Solution 3 - PhpNehal J WaniView Answer on Stackoverflow
Solution 4 - PhpGuillermo HernándezView Answer on Stackoverflow
Solution 5 - PhpKhalid Bin HudaView Answer on Stackoverflow
Solution 6 - PhpYaser AlAzemView Answer on Stackoverflow
Solution 7 - PhpLinuxianView Answer on Stackoverflow
Solution 8 - PhpVitalicusView Answer on Stackoverflow