Server update debian 11 to 12, how to upgrade NC from version 25 to version 27?

Hello Friends,

Nextcloud version (eg, 20.0.5): Nextcloud Hub 3 (25.0.13)
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.56 (Debian)
PHP version (eg, 7.4): PHP 7.4.33

The issue you are facing:

I have Debian 11 with Nextcloud 25 and PHP 7.4. NC 25 is the latest available release under this circumstances.

Now i want to upgrade my debian server from version 11 to version 12, which i did as a test already to find the trouble makers. Nextcloud is one, it quits working after upgrade. PHP 8.2 is too high for Nextcloud 25. I cannot upgrade though. There is no access anymore to do so.

So i reverted and started over to figure out how i could upgrade my Nextcloud from version 25 at Debian 11. And get stuck with the available php versions. PHP versions 8.0 and 8.1 are not longer available. And version 8.2 is too high for Nextcloud 25. And this means that i cannot upgrade to version 26, which i need to upgrade to version 27 to be able to use PHP 8.2 …

I am stuck in a loop here. How do i upgrade Nextcloud from version 25 to version 27 when i cannot proceed with installing version 26? The required php version to do so, version 8.0, is not longer available in the official mirrors it seems. I have at least not found a working one.

E: Unable to locate package php8.0-fpm
E: Couldn’t find any package by glob ‘php8.0-fpm’

I followed (not only) this guide here in the NC wiki, which fits of course also for debian:

Could anyone please lead me to the right direction here?

Kind regards
Arunderan

Is this the first time you’ve seen this error? (Y/N):
y

Steps to replicate it:

Irrellevant. It’s that PHP 8.0 is not longer available and that PHP 8.2 is too high for Nextcloud version 26. So i cannot migrate.

The output of your Nextcloud log in Admin > Logging:

Irrellevant

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

Irrellevant

The output of your Apache/nginx/system log in /var/log/____:

Irrellevant

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

There is none.

NCP current version is 1.53.1
On Debian 11, supporting NC 27.1.6 with php 8.1

Somewhere in next months update to Debian 12 and php 8.2 should be available for Ncp users.
NC doesnt support skipping major updates so you are using outdated versions of both NC and Php. Which updates automatically when Ncp auto updates are enabled.
You should use ncp-config>Updates>nc-update-nextcloud
to first update NC from 25 to 26, it should update your PHP in the process

Best make backup, so you can revert if something goes wrong. :wink:

NCP documentation

Hi Oliver,

Many thanks for the feedback,

I think you have not understand the issue. Yes i am using an outdated version of NC. But i cannot update it since in cannot upgrade to version 26 due missing PHP version. There is no PHP 8 or 8.1 available anymore that would allow me to upgrade to NC 26.

And that’s why i write here. I search for a way HOW to upgrade it.

Kind regards
Arunderan

Are you using NextcloudPi? Or did you install Nextcloud manually from the archive?

It is Nextcloud, not Pi. It is running on a Debian server.

I have just used the Wiki entry for Pi since the advice to upgrade is the same. It is Linux.

I wrote that guide you followed. It’s outdated and exclusively written for how PHP is installed in NextcloudPi.
Maybe i can help.

PHP 8.0 and 8.1 should still be available trough the deb.sury.org repository linked in the guide. I just recently tested the PHP 8.1 guide and it worked.

Did you add that repository to your system?

Which webserver are you using and how is PHP integrated into that webserver? (libapache2-mode/PHP FPM/other?)

Hey,

Many thanks for your answer,

Of course. I followed the advice for version 8.0, and did of course also this step here:

curl -sSL -o /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

But the result was then that apt did not find any php 8:

E: Unable to locate package php8.0-fpm
E: Couldn’t find any package by glob ‘php8.0-fpm’

I tried both guides, even the one for 8.2. Installing php 8.2 worked. But then NC 25 quits working …

Current output about the phh version: PHP 7.4.33 (cli) (built: Jun 9 2023 16:51:37) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

For the rest, not sure. libapache2-mod-php module is definitely not in the list of apache modules. php_fpm neither. Just checked in webmin.

The problem is that i have installed and set up this all years ago. And php with a simple apt install php xx modthis modthat. Like in your advice. The classical LAMP prefork installation. And never bothered with the details as of how this is all integrated and playing together. It worked. Where/how do i find this information how PHP and Apache is playing together here? php_info has a ton of entries. Which special info do you need?

As a note, NC works just fine for years at the server. So there should not be a problem in this regards. Where i am stuck is to install PHP 8.0 or 8.1 so that i can upgrade to NC 26, which allows me to upgrade to NC 27 then.

I think i will give the 8.1 guide yet another try now.

Kind regards
Arunderan

I think i have identified the problem. Sury is blocked as a not signed page.

W: GPG error: Index of /php/ bullseye InRelease: The following signatures were invalid: EXPKEYSIG B188E2B695BD4743 DEB.SURY.ORG Automatic Signing Key deb@sury.org
E: The repository ‘Index of /php/ bullseye InRelease’ is not signed.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Suggestions?

apt-key adv --fetch-keys ‘https://packages.sury.org/php/apt.gpg’ > /dev/null 2>&1

did resolve the issue. FPM is now also enabled. Means it was off before.

Curious enough, the guide has installed PHP 8.3 now too besides version 8.1. And has set it to active. But Webmin 25 still starts and gives me the update option now, so i don’t mind. Let’s try out if upgrading works. But i think the main problem of this issue is resolved. Many thanks :slight_smile:

Kind regards
Arunderan

Upgrade to Version 26 was successful. And as expected, PHP 8.3 makes trouble.

www-data@vmd78197:~/nextcloud$ php occ db:add-missing-indices
This version of Nextcloud is not compatible with PHP>=8.3.

I am still curious why it installs PHP 8.3 when i install explicitely version 8.1. Either way, let’s look if it nevertheless upgrades to version 27. Then this problem should also be gone.

EDIT, version 28 then is.

I would generally reccommand to use PHP 8.2 with NC27, and even for NC28, 8.2 it is still the recommended version. So unless your intention is to run a test instance and report bugs, stay with 8.2 for now. :wink:

Not sure. Maybe because you installed it via Webmin?

Also, the Sury repos offer a script to mangae multiple PHP versions, called “update-alternatives” but I never used it. Managing Multiple Versions · oerdnj/deb.sury.org Wiki · GitHub

My way to install PHP from the Sury repos, is to only install one explicit version via CLI. And when I want to upgrade to a new major version I completly purge PHP and then I install the new version and cofigure it again.

This may not be the most elegant way to do it, and it is a bit more time-consuming, but I’ve never had any issues doing it like that. And as for the config changes, you can either write them down and then re-appy them manually after installing the new PHP version, which takes a few minutes, or you can script it, which then takes 2 seconds to re-apply them again.

I see you did not understand the problem :slight_smile:

I want to upgrade my debian server from version 11 to version 12. And for that i had to upgrade from Nextcloud 25, which uses PHP 7 still. NC 25 does not work anymore with the too high PHP version from Debian 12. I cannot upgrade it then. It simply quits with an error message that the php version is too high. Nextcloud 25 is simply incompatible with PHP 8.2 , let alone 8.3. That’s why i needed to install 8.0 or 8.1 first to be able to upgrade nc to newest version.

I am still at Debian 11. But now with an up to date nextcloud version. And now i can upgrade my Debian to version 12 without to kill my Nextcloud installation. And then i can have a look to enable PHP 8.2 or even 8.3.

Not sure. Maybe because you installed it via Webmin?

How do you come to this coclusion? I followed the advice from the wiki. And this advice is cli. Webmin is at no point involved.

The command is :

# Install PHP 8.1
apt-get -y install php8.1-fpm php8.1-mysql php8.1-xml php8.1-zip php8.1-mbstring php8.1-gd php8.1-curl php8.1-redis php8.1-intl php8.1-bcmath php8.1-gmp php8.1-imagick imagemagick

There is no 8.3 in the command. But still, the command installed version 8.3 at my server. I know this because before the installation i had a look in the etc/php folder. And install date from version 8.3 is the same than the one from 8.1. This command has installed version 8.3 too. Definitely.

curious

And now i have the apache version 8.1 of php, and the cli uses version 8.3 now. Which makes trouble with occ. I cannot fix the missing indices in the database with cli. I guess i need to get rid of the 8.3 php version first.

My way to install PHP from the Sury repos, is to only install one explicit version via CLI. And when I want to upgrade to a new major version I completly purge PHP and then I install the new version and cofigure it again.

This may not be the most elegant way to do it, and it is a bit more time-consuming, but I’ve never had any issues doing it like that. And as for the config changes, you can either write them down and then re-appy them manually after installing the new PHP version, which takes a few minutes, or you can script it, which then takes 2 seconds to re-apply them again.

That’s cool, but i had and have :slight_smile:

I was trying to find possible reasons for the following…

…and then I was trying to tell you what I’m doing to make sure I only have one major version of PHP installed on my system.

Well, in that case they may be leftovers from a previous installation attempt, or another package may have pulled them as a dependency.

# Install PHP 8.1
apt-get -y install php8.1-fpm php8.1-mysql php8.1-xml php8.1-zip php8.1-mbstring php8.1-gd php8.1-curl php8.1-redis php8.1-intl php8.1-bcmath php8.1-gmp php8.1-imagick imagemagick

I just tested that exact command in a fresh Debian LXC and this is how the /etc/php folder looks like:

ls -al /etc/php/
total 12
drwxr-xr-x  3 root root 4096 Feb 11 12:21 .
drwxr-xr-x 69 root root 4096 Feb 11 12:22 ..
drwxr-xr-x  5 root root 4096 Feb 11 12:21 8.1
root@lxc-test:~# 

So again, not sure why there are 7.4 and 8.3 folders on your system, and sorry if my previous post wasn’t helpful.

You could try to purge PHP completly from your system, which should also remove all config files including the /etc/php folder, and then try to install PHP 8.1 again.

apt-get remove --purge php* && apt-get autoremove

EDIT:
Or maybe you could use → the php-updater script ← by @ernolf. But I never tested it myself

No worries, every comment is helpful. It’s just curious that you seem to overrread some bits. Also here again :slight_smile:

No, i already said and even proved by image that this is not the case. Check the image, the install date is one second different between 8.1 and 8.3.

There is no 8.3 in the command. But still, the command installed version 8.3 at my server. I know this because before the installation i had a look in the etc/php folder. And install date from version 8.3 is the same than the one from 8.1. This command has installed version 8.3 too. Definitely.

So again, not sure why there are 7.4 and 8.3 folders on your system, and sorry if my previous post wasn’t helpful.

The 7.4 is the old php installation from Debian 11. The 8.3 version is installed with the 8.1 installation command. Which should simply not happen, but definitely happened. And i am curious why.

You could try to purge PHP completly from your system, which should also remove all config files including the /etc/php folder, and then try to install PHP 8.1 again.

Thank you for the idea, but no. It will most probably simply install PHP 8.3 again anyways :slight_smile:

The main problem, not being able to install php 8 at all is solved. The curiosity of version 8.3 being installed with version 8.1 is another issue now …

Well as I just said, I added the Sury repos to a fresh Debian system, ran the command you posted, and it did not install 8.3. ¯_(ツ)_/¯

…to which I have tried to provide possible answers or help.

Maybe i have polterghost ^^

Here it did :slight_smile:

@Arunderan

I was able to solve this problem by using the process at Upgrade via built-in updater — Nextcloud latest Administration Manual latest documentation. You do not need the deb.sury repo or any other non-Debian sources. The trick is that the command line based updater is independent of the version of PHP.

Once you are successful, I suggest you get rid of the deb.sury repos and install the current Debian PHP, which is version 8.2.7. You can then get rid of all the others.

Many thanks, I will take this into account for the next time :slight_smile:

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.