Any step by step documentation upgrading NC to 25?

I am currently running on Nextcloud 24.0.3 on the following platform.

  • Ubuntu 20.04
  • PHP 7.4.3

Is there any step-by-step documentation for NC 25 including PHP?

Anyone? Any help much appreciated. :slight_smile:

You didn’t provide any information. If you’re expecting help, don’t be stingy with it.

I don’t know what hardware your server runs on, whether you have it at home yourself, because then you should take the opportunity and upgrade to the next LTS release (22.04) right away.

Which apt-sources are used for php?
Informations about the web server used (apache2, nginx)would be fine as well.

Did you once install everything yourself?


You can use the script php-updater if you do not want to upgrade your server to Ubuntu 22.04 and if you don’t know the apt-sources of your php.

Install the script with these commands:

sudo wget -qO /usr/local/bin/php-updater https://global-social.net/script/php-updater
sudo chmod +x /usr/local/bin/php-updater

run it with

sudo php-updater

choose 8.1 as php version

If the script abborts with this message:

‘php8.1’ seems not to be available in your apt-sources
Did you enter a valid version string of an existing php, like ‘8.1’?
Or maybe you need a :ppa or :dpa for your desired php version
You need to solve that first, exiting

then you should run this commands:

sudo add-apt-repository ppa:ondrej/php
sudo apt update

then run sudo php-updater again.

It will guide you through the update process and helps you to migrate all settings from php7.4 to your new php version. Simply allways choose the provided answer (Y or N)


With this command:

for linkgroup in $(ls /var/lib/dpkg/alternatives/ | grep -E "ph(ar|p)"); do sudo update-alternatives --config $linkgroup; done

you can switch from php-version by choosing manual to the desired version instead of auto (to the highest installed) for all php related packages with version alternatives.


Restart your webserver (I still don’t know what server you are on, I assume apache2):

sudo systemctl restart apache2

and look if everything runs fine.

Now it is time to at least make a dump of your database like described here: https://docs.nextcloud.com/server/25/admin_manual/maintenance/backup.html#backup-database

With that dump you have the posibility to restore your nextcloud in your now (24.03) state. The backup from your files is done by the updater:

sudo -u www-data -f /var/www/nextcloud/updater/updater.phar

follow the steps until the end.

Then you should run these occ commands:

occ db:add-missing-columns
occ db:add-missing-indices

No guarrantee
Much luck.

There are still a couple of steps that need to be taken for the server to know which php version to deal with now, but for that you’ll need to provide a bit more information, such as whether you’re using php-fpm or libapache-mod- php etc.

NC 25 still supports php 7.4 (System requirements — Nextcloud latest Administration Manual latest documentation) so I would upgrade NC first and then the system (or the other way round). If not needed, avoid to change two things at a time, if something doesn’t work, it is much easier to debug.
Now is a good time for a backup before you change anything!

For NC, I personally use the updater through command line: sudo -u www-data php updater/updater.phar

For php you already got a lot of hints. I’d also consider updating to Ubuntu 22.04, then you end up automatically at php 8.1. Take your time, these upgrades take a bit of time, packages can change name, after the upgrade, often some php packages are missing and need to be installed.

It is good to have the list of required modules at hand:
https://docs.nextcloud.com/server/25/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation

With apt-cache search you can look for packages.

1 Like