How to configure NC19 to use latest PHP installed on server?

Nextcloud version: 19.0.1
Operating system and version: Ubuntu 18.04 LTS Server
Apache: Apache/2.4.29
PHP version: PHP 7.4.8 (cli)

Total newbie here to Linux and Nextcloud. I am “learning by doing” so please be kind.

I have got as far as installing Ubuntu server and have a Nextcloud instance that is running (on an old laptop that I installed Ubuntu 18.04 Server LTS) via online tutorials I am trying to resolve the remaining security & setup warnings:

  • You are currently running PHP Upgrade your PHP version to take advantage of performance and security updates provided by the PHP Group as soon as your distribution supports it.

  • This instance is missing some recommended PHP modules. For improved performance and better compatibility it is highly recommended to install them.

    • bcmath
    • gmp
  1. If I run php -v the cli version of PHP installed is PHP 7.4.8 (cli). Can someone please explain, in simple terms, how I get my Nextcloud instance to use PHP 7.4? I have tried searching these forums and seen similar questions asked but have not understood the answers confidently enough (since some answers point to files or sections in files that I do not have in my install).

  2. I think if I can get number 1 sorted then I can install the missing PHP modules.

I would appreciate it if anyone can help me.

Thank you in advance for your time.

Nextcloud uses the default PHP version of your web server, so this is not configurable within Nextcloud. It’s part of your OS and web server configuration which PHP version is used. Additionally don’T mix-up the PHP command line and the PHP web components. These are two pairs of shoes. Please read the Nextcloud documentation and use the search function of this forum to find further information, because this kind of question is asked on a regular base:


Thank you for your response. As per my original post I did a search of this forum for the last week or so and then decided to post since I do not understand some of the solutions since they talk about files or locations which I may not have in my installation. Therefore, as a total newbie I am posting here.

Thank you also for the link. I am afraid I don’t understand the solution to my question from it (and then want to break my Nextcloud instance which I have patiently built up and got working).

Is there anyone that could assist with a simple explanation of what I need to do? I am sure it would be helpful for many other people.

From your reply am I right in assuming that whatever version of PHP Apache2 (the web server) is using is the one Nextcloud uses? If so, do I need to do something to “Apache2” to access the latest version of PHP? From your reply, this isn’t the CLI version of PHP. Therefore, how do I upgrade PHP installed for the web server? Am I getting any closer to understanding your reply?

Thank you in advance for your help.

If the Nextcloud description doesn’T help you further, aunt G. might have the right answer for you, e.g.:

I also am a linux newbie and I wrestled with this same question and found this to be of help:
The vm install of NC I have uses PHP-fpm, not cli.
Good luck!


Thank you for your time and efforts thus far in helping me resolve my query.

Since I already had installed PHP7.4 it appears all I had to do was run the commands:

a2dismod PHP7.2

a2enmod PHP7.4

systemctl restart apache2

I then received the alert (settings/Security & setup warnings):

The PHP memory limit is below the recommended value of 512MB

To resolve this I modified the memory_limit from 128M to 512M in the following file:


and then # systemctl restart apache2

This resolved the alert.

In my original post the second alert was installing the missing PHP modules bcmath and GMP. I resolved that alert by:

sudo apt-cache search php7*
sudo apt-get install php7.4-bcmath php7.4-gmp
sudo systemctl restart apache2

The above may be obvious to everyone, but I am posting my solutions in case it may help other newbies.



Thank you fellow newbie. I appreciate your time and effort in posting this.

You can also wait a few week until the official upgrade from ubuntu 18.04 to 20.04 LTS is supported, they wait for the first minor release before pushing it out.