After Ubuntu 18.04 upgrade php7.2-curl cannot be installed
Asked Answered
P

4

31

Upgraded to 18.04 from 16.04 today using do-release-upgrade -d

During the upgrade I was informed that some packages would be removed, these included:

Remove: libperl5.22 lxc-common perl-modules-5.22 php-imagick
php7.1-curl php7.2-curl python3-certbot-nginx

I could re-install imagick and certbot without issue, but if I try to install php7.2-curl I get the message:

# apt install php7.2-curl -y
Reading package lists... Done
Building dependency tree       
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: php7.2-common (= 7.2.3-1ubuntu1) but 7.2.4-1+ubuntu16.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

How can I correct the situation?

Picky answered 8/5, 2018 at 20:49 Comment(3)
sudo apt-get install curl your tring to install an old version for some reasonRuck
curl and php-curl are not the same thing. I have all my php7.2 packages up to date, and for some reason php7.2-curl is being held back due to this incorrect version dependency (I think). I am not sure you are on the right track here @smithPicky
after the upgrade you have to add the package again from ondrej "add-apt-repository ppa:ondrej/php" and then only "apt-get update" and apt-get upgradeShively
A
79

This can save you:

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2-fpm php7.2-gd php7.2-curl php7.2-mysql php7.2-dev php7.2-cli php7.2-common php7.2-mbstring php7.2-intl php7.2-zip php7.2-bcmath

Then sudo service apache2 restart

Anceline answered 8/5, 2018 at 21:9 Comment(7)
why are you installing old versions of curl? its 7.58 packaged with BionicRuck
This did the trick. My PPAs were still there, but for Bionic. So re-adding my PPAs and doing apt update/upgrade and then installing php7.2-curl got me back to a good state :)Picky
also restart the server sudo service apache2 restartRoxy
Thanks, you saved my timeAffirm
exactly what I needed to get all necessary php extensions. ThaksAnabolism
this is not good solution for now, cause this package - php7.2-curl - wants libcurl3, instead of libcurl4Ilan
It worked for me also, I had upgraded my Ubuntu from 18.04 to 20.04 ans Php 5.6 curl was not working for me. After adding ppa:ondrej/php and running commands for Php5.6 it worked for me.Nasalize
G
3

You don't need to add a new repo. Just do this and the 7.2 version will be installed. Remember to restart php and apache after. Also make sure (you've prob already done this though) to enable the new mod after:

sudo apt install php-curl
sudo a2enmod php7.2

You'll also notice probably that at the end of the install of php-curl (which installs php-curl and php7.2-curl) the following (Note that I have FPM setup, might look different if you're not using FPM):

NOTICE: Not enabling PHP 7.2 FPM by default.
NOTICE: To enable PHP 7.2 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.2-fpm
NOTICE: You are seeing this message because you have apache2 package installed.

So do what it says:

sudo a2enmod proxy_fcgi setenvif
sudo a2enconf php7.2-fpm
sudo systemctl restart apache2.service
Gravimeter answered 19/8, 2018 at 1:14 Comment(3)
Can someone clarify the downvote and why this does not work? Don't get me wrong, I would have downvoted as well, but it seems like it should work...it just doesn't. I upvoted Anson Wong's answer because that is what got this working for me after trying this route first, which seemed like the most likely method of getting the modules back. I disregarded the Apache stuff since I am running Nginx, but this seemed like a variation of this should have worked better than installing from a PPA.Delete
Thanks, after upgrading to 18.04 my nignx was set to use php7.0-fpm, with no php_curl being loaded, even though it was installed and referenced in php.ini. Finally I upgraded to php7.2-fpm and the problem fixed itself.Intuition
I downvoted because the question is not about Apache. And I don't know about the time that the answer was posted, but by now, sudo apt install php-curl very definitely is not installing php7.2-curl (it's 7.3, currently). In my case, I need a command line php script to be able to run php7.2-curl when Apache is running on php7.3Cutback
A
0

Installing libcurl4 worked for me using

apt install libcurl4

Then installed php7.2-curl, restarted apache2 without an issue.

Augite answered 7/6, 2019 at 22:52 Comment(0)
B
-1

You have to tackle in mature way. Install aptitude these ubuntu package manager will finds all dependencies, and will install one by one.

apt-get install aptitude

Now you have to check if aptitude can download it or not if download it follow instructions

sudo aptitude install php7.2-curl

If you have gotten any error like this

E: Unable to locate package php7.2-curl
E: Couldn't find any package by glob 'php7.2-curl'

Any type on error i'm not talking about proper these errors

Try to add php package again

sudo apt-add-repository ppa:ondrej/php

sudo apt-get update

Now try this command

sudo aptitude install php7.2-curl

Aptitude will ask you you want to keep current version of all dependencies

The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     php7.2-curl [Not Installed]                        



Accept this solution? [Y/n/q/?]

Type n then Enter

Aptitude will find all dependencies and ask you to install all package type

y

Again

y

Then

systemctl restart apache2

For centos of rhel

systemctl restart httpd

It will Not enabling PHP 7.2 FPM by default. NOTICE: To enable PHP 7.2 FPM in Apache2 do

a2enmod proxy_fcgi setenvif

a2enconf php7.2-fpm

This method is not only for this error you can find any of php apache2 or ubuntu system package solution using aptitude.

Upvote if you find your solution
Britain answered 9/10, 2021 at 20:38 Comment(1)
Please do not post the same answer under different questions without checking the context of the question. The error in the question does not look like the one you've mentioned in this answer after allCombustor

© 2022 - 2024 — McMap. All rights reserved.