How to install php-curl in Ubuntu 16.04
Asked Answered
D

8

89

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

Delmydeloach answered 6/8, 2016 at 4:41 Comment(5)
are you sure it's not installedand not just disabled? use php5enmod command to enable it.Prang
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)Duky
@frankerZ My projects not working under PHP7Delmydeloach
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.Duky
I've 15-20 projects on local and live servers not in my handDelmydeloach
D
271

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
Delmydeloach answered 6/8, 2016 at 6:34 Comment(5)
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 problemSlant
use php -version to find out what version of PHP you're onFarman
Perfect, but how do you fix libcurl issues with PHP 7.2 (needs libcurl4) and Percona MySQL 5.7 (needs libcurl3)?Psychedelic
@Slant yes, your suggestion worked for me as well.Anhedral
It seems, that these versions are no longer part of ubuntu 18.10Troup
A
37

This worked for me.

sudo apt-get install php-curl
Amyloid answered 8/8, 2016 at 5:42 Comment(2)
Yes, this works without having to specify a PHP version if the user doesn't know it.Staid
Worked for me too on Amazon EC2 Ubuntu 16Spodumene
O
21

This works for me:

sudo apt-get install php5.6-curl
Ongoing answered 6/8, 2016 at 6:33 Comment(0)
G
7

Do:

apt-get update

And then:

apt-get install php5-curl
Guidance answered 26/5, 2017 at 19:44 Comment(0)
I
3

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.

Intelligible answered 12/4, 2019 at 14:58 Comment(0)
F
3
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt install php8.0-curl
Francesco answered 12/3, 2021 at 22:37 Comment(0)
D
2

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
Dislimn answered 7/3, 2017 at 22:21 Comment(0)
C
2
sudo apt-get install php5.6-curl

and restart the web browser.

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

Clip answered 30/10, 2018 at 10:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.