Home > database >  How to install php7.2-curl extension in ubuntu21.04? [closed]
How to install php7.2-curl extension in ubuntu21.04? [closed]

Time:09-17

I want to install curl extension in my current php-project(php version is 7.2.34) for that i use this command sudo apt-get install php7.2-curl it's throwing following error and it's not showing in the list when i run php -m command ,How to install curl extension please help me to fix this issue..

my ubuntu description

o LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 21.04
Release:    21.04
Codename:   hirsute

when i run apt policy php7.2-curl

php7.2-curl:
  Installed: (none)
  Candidate: 7.2.34-24 0~20210826.64 debian9~1.gbp428dfa
  Version table:
     7.2.34-24 0~20210826.64 debian9~1.gbp428dfa 500
        500 https://packages.sury.org/php stretch/main amd64 Packages
     7.2.34-23 ubuntu21.04.1 deb.sury.org 1 500
        500 http://ppa.launchpad.net/ondrej/php/ubuntu hirsute/main amd64 Packages

Error

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.2-curl : Depends: libcurl3 (>= 7.44.0) but it is not installable
E: Unable to correct problems, you have held broken packages.

CodePudding user response:

Manually download libcurl3 from https://packages.ubuntu.com/bionic/amd64/libcurl3/download

Then use apt install /path/to/package/downloaded/libcurl3_7.58.0-2ubuntu2_amd64.deb to install the missing dependency. Or you can use

dpkg -i /path/to/package/downloaded/libcurl3_7.58.0-2ubuntu2_amd64.deb
apt-get install -f

Run apt update, apt upgrade and apt install php7.2-curl to finally install curl extension.

CodePudding user response:

Ubuntu 21.04 (hirsute) comes with php7.4 and libcurl4. Unfortunatelly libcurl3 is not present in official repos. I suggest you to update PHP to version 7.4 so you can use packeges from Ubuntu repository: https://packages.ubuntu.com/hirsute/php7.4-curl

To do so remove all old php modules you installed with apt remove php* and install with 'apt install php7.4 php7.4-curl'.

Otherwise, if you really need PHP version 7.2, I can suggest to downgrade to Ubuntu 18.04LTS (bionic).

  • Related