Ubuntu 18.04 server: 'PHP modulle cURL not installed'... but it is indeed installed

I have been running NextCloud 13.05 on Ubuntu 16.04 and did a distribution upgrade to Ubuntu 18.04. So that now gives me php 7 rather than php 5.
Now when I go to the login page, I get the following message:

  • PHP module cURL not installed.
    Please ask your server administrator to install the module.
  • PHP modules have been installed, but they are still listed as missing?
    Please ask your server administrator to restart the web server

But running ‘php -m’ does list the curl module.
And I ran ‘phpenmod curl’ to make sure it’s enabled.

I read a thread in the ownCloud forums that suggested I should try uninstalling php 5 and its modules.
So I ran

sudo apt-get purge dpkg -l | grep php5| awk '{print $2}' |tr "\n" " "

and restarted the server. No change, still get the error message.
Has anyone else encountered this problem during a dist upgrade to Ubuntu 18.04?

Does anyone have the solution?

Thanks in advance for whatever help.

Sure, dist upgrade are always a pain so that’s why it is not recommended to do. Better install a fresh system.

Maybe Curl was not updated correctly with the distro uprade? For Ubuntu 18.04
$ curl --version
should say: curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0

Take a look here: http://www.codebind.com/linux-tutorials/install-curl-ubuntu-18-04-lts-linux/

This happened to me after run:

apt-get install clamav clamav-daemon

The following packages will be REMOVED:
libcurl3 php7.2-curl

Ubuntu 18.04 server

The issue might be that your system has multiple php.ini files. I’m having the same issue after moving to Ubuntu 18 / PHP 7.2. curl is clearly installed, but cannot sort out what is not working.

I have solved the issue, at least in my case. The problem stemmed from fact that Apache was still using older version of PHP. So any missing libraries, were inaccessible via legacy PHP.

In short order, here is what the fix was:

sudo a2dismod php5.1
sudo a2enmod php7.2
sudo service apache2 restart

Some suggested reading: https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/