Cannot upgrade to NC 26 due to PHP 7.4

I’m using a Hanssonit NextCloud VM. It’s been deployed for awhile and works better than my first Docker attempt. However, I tried updating to NC 26 this morning and it bombed out telling me it failed due to PHP. I appear to have 7.4 installed. Is it difficult to update PHP manually? I’m not very well versed in Linux, I’m Windows. I can pay Hanssonit to update it, but I’d rather not have to pay if I can work through it myself.

Due to my limited experience, am I out of my league trying to consider updating PHP and should I just pay the update maintenance from them? Or, is there a simple set of instructions that I could follow and work through?

Are you running it in a VM-Ware, VirtualBox or what?

When you expect some help, you should provide information!

As far as I know, those Virtual Mashines are running on Ubuntu. So you can upgrade the underlying Ubuntu as normal as every Ubuntu Server with the apropriate tools.

Please provide information about the level of your skills. How did you upgrade your server so far?

It’s runnin a VMware virtual machine on VMware Player. Yes it’s running Ubuntu as the underlying O/S

When I’ve updated NC In the past, I use the following two commands from the VM console:

Major: sudo bash /var/scripts/
Minor: sudo bash /var/scripts/ minor

I can follow instructions with Linux, but I don’t have a background to what commands I ought to use if they are not listed, etc. If it’s easy enough as in type X commands to update I can do. If it’s a go update a dependency first and we don’t provide instructions for it, then I will likely have issues.

It should be fairly easy to Google something like “ubuntu upgrade php” or similar to find the answers you need, no? :slight_smile:

1 Like

I wasn’t sure if there was something specific related to NextCloud that I had to be aware of Again my Linux knowledge is limited so I didn’t want to just assume it easy, I’d definitely go that route with Windows but I wanted to ask the community if this was about as easy

I wouldn’t say so - Nextcloud is “just” a bunch of PHP files. But part of upgrading PHP for Nextcloud is to check that you are upgrading to a PHP version that is supported by both Nextcloud and the apps in Nextcloud that you intend to run (the apps themselves are PHP code too, so they need to support the PHP version). And also, some PHP extensions are needed as well, so these too will be upgraded.

Doesn’t VMware Player support snapshots? If I had a VM, I’d take a snapshot of it and then go all in on trying the upgrade, and only when I know everything truly works for a while fine I’d delete the snapshot. If things doesn’t work out, just restore the snapshot.

VMware Player doesn’t support snapshots, however I do backup the VM folder regularly and can make a new backup prior to upgrading PHP.

I was trying to do a little research on upgrading PHP, although I can’t say if the Extensions update automatically or not. I believe the only App I was using that utilized PHP was a Passwords app but I’ve switched out recently to another

That works too. It’s a good idea to shut the VM down entirely (including the OS in it - not just suspending it) first.

I’d just do that and go for it. If you encounter problems you an ask about those specifically when you hit them.

1 Like

Well I guess there is extra config that needs done with NextCloud. I removed PHP7 and installed 8.1 and common dependencies. The console command php -v reported version 8.1.17 installed. But, then my NextCloud instance was entirely unusable, just got a 503 Service Unavailable and couldn’t get it up. The VM booted fine, rebooted fine, but removing PHP7 must have altered other files that NC relies on. Rolled back to my backup and the server is good, but is there just a simple upgrade to PHP8 or do I need to fully remove PHP7 first?

@enoch85 What needs to be done to update PHP on the VM?

What kind of php your VM was using? php module or php-fpm?

what is the echo of
ls -l "/etc/apache2/conf-enabled/"

Based on this output, I would assume php-fpm

lrwxrwxrwx 1 root root 30 Feb 27 2022 charset.conf → …/conf-available/charset.conf
lrwxrwxrwx 1 root root 44 Feb 27 2022 localized-error-pages.conf → …/conf-available/localized-error-pages.conf
lrwxrwxrwx 1 root root 46 Feb 27 2022 other-vhosts-access-log.conf → …/conf-available/other-vhosts-access-log.conf
lrwxrwxrwx 1 root root 33 Feb 27 2022 php7.4-fpm.conf → …/conf/available/php7.4-fpm.conf
lrwxrwxrwx 1 root root 31 Feb 27 2022 security.conf → …/conf-available/security.conf
lrwxrwxrwx 1 root root 36 Feb 27 2022 serve-cgi-bin.conf → …/conf-available/serve-cgi-bin.conf

Verry good.

Here you get a Step by Step upgrade procedure of your php:

Step 1

Upgrade your system:

sudo apt-get update && sudo apt-get dist-upgrade

Check if reboot required with this commandline:

[ -f /var/run/reboot-required ] && { echo "Reboot required"; read -p "Press ENTER to reboot or ^C to cancel" dummy; sudo systemctl reboot; exit; } || echo "No reboot required"

Step 2

Install the new php-Packages with this commands:

packages="$(echo $(dpkg -l | awk '/^ii/ {print $2}' | grep -i php7.4 | sed 's/php7\.4/php8.1/g'))"
sudo apt-get install $packages

Step 3

check the configuration files:

You now have two php directories in /etc/php:


In both directories are two subdirectories that interest us: cli and fpm

Now you have to take over the settings from the 7.4/cli/php.ini and 7.4/fpm/php.ini files into the 8.1 Versions.

If some variables are removed in the new Version, it may be, that those are removed from the new php-version.

Specially this vallues you should look for:


and if your Nextcloud uses redis:


Now you should take a look into the file /etc/php/7.4/fpm/pool.d/www.conf
and take over this settings into the new (8.1) Version:


Step 4

Now deaktivate the old php7.4-fpm and activate the new php8.1-fpm with this commands:

sudo a2disconf php7.4-fpm
sudo a2enconf php8.1-fpm
sudo systemctl reload apache2

Step 5

Check if your Nextcloud is running as expected.

Step 6

Remove the old php:

sudo apt-get remove --purge php7.4*

Step 7

Do the Nextcloud Server update:

sudo -u www-data php -f /var/www/nextcloud/occ app:update --all
sudo -u www-data php -f /var/www/nextcloud/updater/updater.phar

Calmly do everything step by step!

Much luck

I think this is an important information for all who read here by chance. The updater of Nextcloud 25 also works with PHP8.2.


There are several guides online on how to upgrade PHP in general. You need to keep in mind that we run some PECL dependencies and that it’s PHP-FPM with a certain setup, and you need to change the apache config in some places.

We offer support here:

1 Like

I appreciate everyone’s suggestions, however I wasn’t able to make it work. Not sure if it’s the specific VM I had but the commands were producing failures, and I couldn’t properly update PHP.

On the other hand, I did contact Hansson IT and he was very good and updated PHP and the server very quickly, so hats off to him! Apparently, I need to brush up on my Linux skills.

Thanks again for everyone’s insight

1 Like

Do you have paid version of VM or free as me? :slight_smile:

I paid for the VM last year.

Hanssonit NextCloud VM
I also have one of these. Also I am not able to get from php 7.4 to 8.X because of dependencies and certain setups. Also it is anything but trivial to move the NextCloud data and user settings to a more modern instance. I feel trapped.
I use the NC for our band without commercial background but I want to stay independent. Was it a mistake to use a pre-installed NC?

PECL are in place just to be able to get the absolute latest stable versions of the specific PHP dependencies - as Ubuntu repo maintainers usually are not catching up, which in turn could lead to security flaws (not running the latest updates). It happened before, and will happen again.

There’s a reasoning and thought behind every decision in the NcVM. We (mostly myself) have been developing it since back in 2014, even before Nextcloud was founded. It’s solid! Stability is better than new features if you ask me.

It’s your own choice to either install everything on your own, or download a pre-configured package, but as a lazy sysadmin I would prefer the latter - a pre-configured VM made by someone who’s in love with Nextcloud and tried to make it as simple and secure as possible for everyone else to enjoy the benefits of freedom!

I didn’t have a clue about anything in 2013, so I built it mostly to help myself, then I figured, why not share it? And so I did. Now thousands and thousands of users have deployed it, and those deployments also require support from time to time, do you expect us to work for free?

Generally, if you just follow the recommendations written all over the internet (use the built in update script and update regularly) you are good to go for years to come (if not Nextcloud decide to deprecate a PHP version, and you don’t know how to upgrade) without any need for support. And hopefully, during that time, you’ve learned enough Linux to manage the PHP upgrades on your own. If not, we are here to help you - as a service - because we don’t need to really.

You can see it in two ways; either you applaud us for great work, or you think we are really stupid to charge for the services we offer. Which one are you? :slight_smile: