(Please see both edits). Ubuntu 18.04, PHP 7.4.2. I would like help installing the Curl PHP package on my server. Here is the issue I'm encountering, and what I've tried so far:

When I run sudo apt-get install php-curl, I am met with the following error:

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:
 php-curl : Depends: php7.4-curl but it is not going to be installed

I followed these steps to identify and remove broken packages to try and rectify the first half.

When I run sudo apt-get install php7.4-curl I get this error:

The following packages have unmet dependencies:
 php7.4-curl : Depends: libcurl4 (>= 7.56.1) but it is not going to be installed

So I tried sudo apt-get install libcurl4, and received this:

The following additional packages will be installed:
The following packages will be REMOVED:
  apache2 apache2-bin libapache2-mod-php libapache2-mod-php7.0
  libapache2-mod-php7.4 libcurl3 python-certbot-apache python3-certbot-apache
The following NEW packages will be installed:
  libcurl4 php7.4-fpm
0 upgraded, 2 newly installed, 8 to remove and 0 not upgraded.
Remv python-certbot-apache [0.31.0-1+ubuntu18.04.1+certbot+1]
Remv python3-certbot-apache [0.31.0-1+ubuntu18.04.1+certbot+1]
Remv apache2 [2.4.41-1+ubuntu16.04.1+deb.sury.org+5]
Remv libapache2-mod-php [2:7.4+75+ubuntu18.04.1+deb.sury.org+1]
Inst php7.4-fpm (7.4.4-1+ubuntu18.04.1+deb.sury.org+1 ***** The main PPA for supported PHP versions with many PECL extensions *****:18.04/bionic [amd64])
Remv libapache2-mod-php7.4 [7.4.4-1+ubuntu18.04.1+deb.sury.org+1]
Remv libapache2-mod-php7.0 [7.0.33-26+ubuntu18.04.1+deb.sury.org+1]
Remv apache2-bin [2.4.41-1+ubuntu16.04.1+deb.sury.org+5]
Remv libcurl3 [7.58.0-2ubuntu2]
Inst libcurl4 (7.58.0-2ubuntu3.8 Ubuntu:18.04/bionic-security [amd64])
Conf php7.4-fpm (7.4.4-1+ubuntu18.04.1+deb.sury.org+1 ***** The main PPA for supported PHP versions with many PECL extensions *****:18.04/bionic [amd64])
Conf libcurl4 (7.58.0-2ubuntu3.8 Ubuntu:18.04/bionic-security [amd64])

I don't understand why it wants to remove apache2, certbot, and various other important packages. Can anybody advise on how Curl can be installed without removing so many other packages?


I followed this guidance to remove everything related to PHP, then this to install PHP7.2 (as advise: the version that 18.04 shipped with). PHP -v now returns PHP 7.2.29-1+ubuntu18.04.1+deb.sury.org+1. However, I still encounter the same issues. After a recommendation to try installing with aptitude, the error message is a bit more detailed:

    The following NEW packages will be installed:
  libcurl4{ab} php7.4-common{a} php7.4-curl
The following packages will be REMOVED:
  libonig4{u} libpcre2-8-0{u}
0 packages upgraded, 3 newly installed, 2 to remove and 0 not upgraded.
Need to get 245 kB/1,243 kB of archives. After unpacking 7,098 kB will be used.
The following packages have unmet dependencies:
 libcurl3 : Conflicts: libcurl4 but 7.58.0-2ubuntu3.8 is to be installed
 libcurl4 : Conflicts: libcurl3 but 7.58.0-2ubuntu2 is installed
The following actions will resolve these dependencies:

     Remove the following packages:
1)     apache2 [2.4.41-1+ubuntu16.04.1+deb.sury.org+5 (now)]
2)     apache2-bin [2.4.41-1+ubuntu16.04.1+deb.sury.org+5 (now)]
3)     libapache2-mod-php7.2 [7.2.29-1+ubuntu18.04.1+deb.sury.org+1 (bionic, now
4)     libcurl3 [7.58.0-2ubuntu2 (bionic, now)]
5)     python-certbot-apache [0.31.0-1+ubuntu18.04.1+certbot+1 (bionic, now)]
6)     python3-certbot-apache [0.31.0-1+ubuntu18.04.1+certbot+1 (bionic, now)]

Does this information give any indication on why it wants to remove apache2 and the other modules in the list before curl/libcurl can be installed?

Edit 2:

After much fiddling and frustration (and desperation) I tried the following, as recommended on this thread:

sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php-curl

The output for the first four repository commands was component is already enabled for all sources. ppa:ondrej/php was already added, as was the ondrej/apache2. I'd run sudo apt-get update several times.

But, somehow, doing those things in that order fixed whatever the issue was, and I now have cURL functioning on my server.

  • Your much bigger problem is "Why is my favorite PPA not being properly maintained?" since that threatens the security and stability of your entire stack. To answer that question, you must contact the PPA maintainer. It's very possible to have a safe, secure webserver (and cURL) using software in the Ubuntu repositories.
    – user535733
    Mar 31, 2020 at 12:41
  • Thanks for the pointer, although now I have two big problems with no idea how to resolve either.. Would you recommend not using a PPA for PHP7.4?
    – chr0s
    Mar 31, 2020 at 13:26
  • If you must use 7.4 for specific features, then you chose the wrong release of Ubuntu to install. If you want 7.4 because it's the newest (security), then you misunderstand how security works in Ubuntu (a common mistake among newer users), and the 18.04 Ubuntu repositories (php 7.2-with-security-patches) should be your first choice. Opinion: When possible, avoid non-Ubuntu sources --including most PPAs-- and stick to the tested, compatible Ubuntu repositories.
    – user535733
    Mar 31, 2020 at 14:59
  • Thanks for your reply. I'm very much figuring this out as I go along (which is probably eminently obvious). I recall PHP7.4 being a requirement for either http2 or webp. Do you recommend rolling back to PHP7.2?
    – chr0s
    Mar 31, 2020 at 15:07
  • I'm attempting to roll back to php7.2. I followed this advice to remove everything associated with PHP, and the "install PHP7.2 section" here to install the new version of PHP, along with recommended modules. This worked well: PHP -v showed 7.2, and my sites worked. However, trying to install curl gave the same errors as above, except it required libcurl >=7.44.0 rather than >=7.56.1.
    – chr0s
    Apr 2, 2020 at 10:46

1 Answer 1


You are using an additional repository called a PPA (Personal Package Archive). As explained here:

Packages in PPAs do not undergo the same process of validation as packages in the main repositories.

That means that dependencies will not necessarily work for all base systems (and it also has security implications):

PPAs are a low-security alternative to the main repositories, so the user will be installing software at their own risk.

  • Would you advise using against a PPA where possible?
    – chr0s
    Mar 31, 2020 at 13:59
  • Sometimes you just have to add a PPA or an external repository. But if you can stick to the official ones, do. It's also a good idea to see how well maintained they are. Mar 31, 2020 at 14:04
  • Are you able to look at the edit to my original question and see if you can suggest where to go next?
    – chr0s
    Apr 2, 2020 at 11:45
  • PPAs are fine as long as you trust the author, you know what you're doing and how to roll back if there are issues with a PPA.
    – pLumo
    Apr 2, 2020 at 13:16
  • Good to know. At the moment my dependencies cannot be resolved and whatever I've done means that I can't install cURL, which I need for a site on my server. I'm struggling to know where to look next.
    – chr0s
    Apr 2, 2020 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.