How to migrate/upgrade from php7.4 nextcloud 25.0.9 to new server running php 8.2

Hi,

I’ve tried a few approaches to migrate from the current server php7.4/nextcloud 25.0.9 to a new server running php8.2. without success.

I’d appreciate any guidance to identify the steps to move to the new server running php8.2 where I expect I can then upgrade nextcloud to 26.x and then to 27.x.

The info.xml for version 25.0.9 is limiting upgrades to the v25.x version family.

I don’t think installing the latest server version on the new server and then pointing it at the v25.0.9 database and using the associated ‘data’ and ‘config’ folders will work although I have not tried that. Nextcloud docs indicate you must follow the version upgrade path one version at a a time.

Any guidance would be appreciated.

Thank you.

Jim.

Can’t you just upgrade PHP on the existing server?

  1. Upgrade to PHP 8.0 or 8.1
  2. Upgrade to NC26
  3. Upgrade to NC27
  4. Upgrade to PHP 8.2.

Steps 3 and 4 can also be done in reverse order.

NC25 supports PHP 7.4, 8.0 and 8.1
NC26 and NC27 support PHP 8.0, 8.1 and 8.2

Important:
Don’t skip any NC versions!

1 Like

The current server runs debian 11 which does not support php8.2 out-of-the-box. The new server is running debian 12 which does support php8.2.

I could install php8.1 on the debian 11 server using other repos. With this in mind - would this be your recommendation?

Thanks for the quick response bb77.

Jim.

I personally use the Sury repos since forever and I never had any issues with them. Ondrej Sury, the maintainer of these repos, is also one of the maintainers of PHP in the Debain project, so I’d say he’s a) trustworthy and b) he knows what he’s doing, so no issues from that side either.

So here’s my recommendation:

If you have planned the migration only because of the PHP version, I would continue to use the existing server. Update everything, by using the Sury repos, as described in my previous post, and then upgrade the system to Debian 12 after that.

If there are other reasons for the migration as well, like better, more powerful hardware, more storage, memory etc…) then my preferred method would be similar to the one without migration, i.e. update everything on the first server, and only then migrate it over to the new server.

That beeig said, there might also be ways to cut a few corners, I think I even read somewhere about updating NC to 26 without having a compatible PHP version installed. I’m not sure I would recommend trying that exact thing, but it might be worth to do some additional research in in the forums before you start. The hole “Debian / old PHP version / Upgrade to 26 topic” actually came up quiet a few times here, and there are some extensive threads about this topic…

Whether you want to start experimenting, or if you decide to go the safe route, is up to you, and I’d say this should mainly depend on how easy you can recover to a previous working state in case something goes wrong. If everything is running in VMs from which you can take snapshots, why not experiment a little bit…? :wink: Otherwise, I would go the safe route, and regardless of what you are doing, make sure you always have working backups!

Good luck! :slight_smile:

1 Like

**Below is a reply sent by email - it had an attachment which is maybe why it did not post to the thread **

bb77,

With your help and other posts I was able to upgrade from v25.0.9 to 26.0.4. Here’s the story …

server 1: debian bullseye, php7.4
server 2: debian bookworm, php8.2-fpm

1st attempt:
Using the sury repo I updated server 1 to php8.1. However nextcloud threw an internal server error and I couldn’t find much in the apache logs to figure out how to fix it.

2nd attempt:
I tried to do a version upgrade of server 1 to bookworm using this thread: HowTo: Upgrade to Nextcloud 26 on Debian Bullseye

The server upgrade failed at a number of points so I gave up on that idea.

3rd attempt:
After reading a bunch of posts with different ideas/options I copied the nextcloud files from server 1 to server 2. Then I pointed server 2 to a copy of the server 1 db and a copy of the server 1 data store so it could run without interfering with the live server 1 instance.

Using this post: Upgrade to Debian 12 Bookworm - #6 by bb77

I ran ‘sudo -u www-data php nextcloud/updater/updater.phar’

I got this error: This version of Nextcloud is not compatible with PHP>=8.2. You are currently running 8.2.7. It was solved by running

'sudo sed -i ‘s/>= 80200/>= 80300/’ nextcloud/lib/versioncheck.php

from this post: Update to php8.2 - #2 by flow-axel

Next up was this error (it may have been the first error - can’t remember): An unhandled exception has been thrown: OCP\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)

Turns out I was missing php8.2-apcu and had to enable it in /etc/php/8.2/cli/php.ini using this post: Don't allow executing cli if cache backend is unavailable by st3iny · Pull Request #25770 · nextcloud/server · GitHub

As mentioned earlier I use proxmox vms so I was able to run a clean copy of server 2 each time I fixed an issue.

After the issues were fixed, ‘sudo -u www-data php nextcloud/updater/updater.phar’ ran the upgrade successfully - it is now v26.0.4 with the option to upgrade to 27.0.1.

Many thanks for the help with this effort. Now I’ll plan out migrating the live environment to a clean copy of server 2.

Jim.

2 Likes

Interesting, since so many others reported that the CLI upgrade is possible without PHP 8.2 limitation. I just know that the updater.phar itself is a standalone script with its very own PHP dependencies, where the NC25 version supports PHP 8.2 already. But I did not find the time to test whether at some point it loads NC core scripts, including the versioncheck.php. Now we seem to know, but confusing too see to many contradicting reports.

Many thanks for the recommendation bb77.

I run proxmox vms. So I’ll clone the live server and work through your recommended flow on the clone using a copy of the db and datastore until I can get each step working. Then I’ll have a documented process to run on the live server.

Thank you very much.

Jim.