Question

cURL is not installed on this server after updating to Ubuntu 20.04

Posted November 15, 2020 216 views
UbuntuUbuntu 20.04

I’ve updated Ubuntu from 16.04 to 18.04 and then from 18.04 to 20.04. Now two plugins on Wordpress give me these errors:

1- OneSignal Push: cURL is not installed on this server. cURL is required to send notifications. Please make sure cURL is installed on your server before continuing.

2- Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: curl

I’ve tried every related solution on the internet so far but could not solve this problem yet. I ran sudo apt-get install curl, but nothing has changed. I also got this: curl is already the newest version (7.68.0-1ubuntu2.2)

1 comment
  • More information:

    sudo apt install php-curl > output > The following packages have unmet dependencies: php-curl : Depends: php7.4-curl but it is not going to be installed E: Unable to correct problems, you have held broken packages

    It is stated in another forum that this error is related to remnants from the previous PHP installations of previous Ubuntu versions.

    Checking which packages that contain curl are (still) installed: dpkg -l ’curl’ | grep ^ii

    output:

    libcurl3-gnutls:amd64 7.68.0-1ubuntu2.2 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour) ii libcurl4:amd64 7.68.0-1ubuntu2.2 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour) ii python3-pycurl 7.43.0.2-1ubuntu5 amd64 Python bindings to libcurl (Python 3) –

    But, I don’t know how to go from here.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

Hi @rem3n,

You’ll need to install PHP’s curl module rather than the curl service on your server. Try to execute the following command on your droplet

apt list --installed php*

It will show you all your PHP packages. It’s possible you actually have two PHP versions rather than one. You can remove the old one and just use the newest.

Regards,
KFSYS

  • Hi, it is said that it has to do with broken APT packages due to failed distro upgrade which makes sense to me, but I am unable to solve this.

    The output:

    php-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php-bz2/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-common/now 2:79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-gd/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-gmp/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-json/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-mbstring/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-mysql/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-pspell/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-recode/now 1:7.2+60ubuntu1 all [installed,local]
    php-soap/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-tidy/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-xml/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-xmlrpc/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-zip/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php5.6-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.0-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.0-bz2/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-cli/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-common/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-gd/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-gmp/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-json/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-mbstring/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-mysql/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-opcache/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-pspell/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-readline/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-soap/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-xml/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-xmlrpc/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-zip/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
    php7.1-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.1-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.2-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.2-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.2-common/now 7.2.24-0ubuntu0.18.04.7 amd64 [installed,local]
    php7.2-recode/now 7.2.24-0ubuntu0.18.04.7 amd64 [installed,local]
    php7.3-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.3-cli/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-common/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-fpm/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-gd/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-json/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-mbstring/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-mysql/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-opcache/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-readline/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-xml/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-xmlrpc/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-zip/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
    php7.4-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.4-bz2/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-cli/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-common/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-fpm/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-gd/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-gmp/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-json/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-mbstring/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-mysql/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-opcache/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-pspell/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-readline/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-soap/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-tidy/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-xml/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-xmlrpc/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-zip/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4/now 7.4.12-3+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
    php8.0-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php/now 2:7.4+79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]

    • I can see you don’t have the php-curl package in any of the PHPs you have installed. If you try

      apt install php7.4-curl
      

      Does anything get installed? Once it’s installed try and run

      /usr/bin/php7.4 -m | grep curl
      

      If it has it, then change your PHP version to use the binary for 7.4

      • I was getting this when I try to install curl: The following packages have unmet dependencies: php-curl : Depends: php7.4-curl but it is not going to be installed E: Unable to correct problems, you have held broken packages

        It was stated that an older version of php7.4-common still installed which causes issues. I ran sudo apt-get purge php7.4-common and then “sudo apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath” And, the problem has been solved, I don’t get curl is missing error now. Though this problem has been solved I have to make sure that there is no mess in the server, what can I do?

Hi @rem3n,

I’m glad the issue is resolved now!

Regarding cleanup, I saw you have a lot of PHP versions installed. If you are not using them, I’ll recommend removing all of them but the one that you are using.

Regards,
KFSys

  • Which ones should I remove and how? Could you give me commands. Current list:

    php-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php-bcmath/focal,now 2:7.4+75 all [installed]
    php-cli/focal,now 2:7.4+75 all [installed]
    php-common/now 2:79+ubuntu16.04.1+deb.sury.org+4 all [installed,local]
    php-curl/focal,now 2:7.4+75 all [installed]
    php-fpm/focal,now 2:7.4+75 all [installed]
    php-gd/focal,now 2:7.4+75 all [installed]
    php-json/focal,now 2:7.4+75 all [installed]
    php-mbstring/focal,now 2:7.4+75 all [installed]
    php-mysql/focal,now 2:7.4+75 all [installed]
    php-pear/focal,now 1:1.10.9+submodules+notgz-1 all [installed]
    php-recode/now 1:7.2+60ubuntu1 all [installed,local]
    php-xml/focal,now 2:7.4+75 all [installed]
    php-zip/focal,now 2:7.4+75 all [installed]
    php5.6-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.0-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.0-bz2/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-cli/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-common/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-gd/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-gmp/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-json/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-mbstring/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-mysql/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-opcache/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-pspell/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-readline/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-soap/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-xml/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-xmlrpc/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0-zip/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.0/now 7.0.33-37+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
    php7.1-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.1-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.2-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.2-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.2-common/now 7.2.24-0ubuntu0.18.04.7 amd64 [installed,local]
    php7.2-recode/now 7.2.24-0ubuntu0.18.04.7 amd64 [installed,local]
    php7.3-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.3-cli/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-common/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-fpm/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-gd/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-json/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-mbstring/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-mysql/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-opcache/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-readline/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-xml/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-xmlrpc/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3-zip/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.3/now 7.3.24-3+ubuntu16.04.1+deb.sury.org+1 all [installed,local]
    php7.4-apcu-bc/now 1.0.5-4+ubuntu16.04.1+deb.sury.org+1 amd64 [installed,local]
    php7.4-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php7.4-bcmath/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-cli/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-common/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-curl/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-fpm/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-gd/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-json/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-mbstring/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-mysql/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-opcache/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-readline/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-xml/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4-zip/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 amd64 [installed,automatic]
    php7.4/focal-updates,focal-security,now 7.4.3-4ubuntu2.4 all [installed,automatic]
    php8.0-apcu/now 5.1.19+4.0.11-2+ubuntu16.04.1+deb.sury.org+4 amd64 [installed,local]
    php/focal,now 2:7.4+75 all [installed]

Submit an Answer