Upgrade nextcloud 27 and php error

Hello

Nextcloud version (eg, 20.0.5): 27.1.5
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.56
PHP version (eg, 7.4): PHP 8.1.26 (cli)

The issue you are facing:

I’ve just updated my server to version 27 (I was always on 26 before), and I get the warning message in the admin panel even though I’m running PHP 8.1.26.

There are some warnings regarding your setup.

* You are currently running PHP 8.0.30. Upgrade your PHP version to take advantage of [performance and security updates provided by the PHP Group ↗](https://secure.php.net/supported-versions.php) as soon as your distribution supports it.

* PHP 8.0 is now deprecated in Nextcloud 27. Nextcloud 28 may require at least PHP 8.1. Please upgrade to [one of the officially supported PHP versions provided by the PHP Group ↗](https://secure.php.net/supported-versions.php) as soon as possible.

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

I don’t understand why nextcloud is telling me that I’m at 8.0.30, when I’m actually using php 8.1.26, so what do I do now.

# php -v
PHP 8.1.26 (cli) (built: Nov 24 2023 13:12:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.26, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.26, Copyright (c), by Zend Technologies

Thanks for your help.

Maybe your Apache settings still use php8.0

check on your server, on putty write this
update-alternatives --config php
or
update-alternatives --set php /usr/bin/php8.1

and check your apache configuration

<FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost"
</FilesMatch>

hi

i checked my server with you command update-alternatives --config php

# update-alternatives --config php
Il existe 2 choix pour l'alternative php (qui fournit /usr/bin/php).

  Sélection   Chemin           Priorité  État
------------------------------------------------------------
* 0            /usr/bin/php8.1   81        mode automatique
  1            /usr/bin/php8.0   80        mode manuel
  2            /usr/bin/php8.1   81        mode manuel

Appuyez sur <Entrée> pour conserver la valeur par défaut[*] ou choisissez le numéro sélectionné :2

By default I’m in 8.1, so I forced the choice by taking option 2 and the warning is still there in nextcloud

so I went back to the original automatic configuration.

in the apache configuration, however, I found this:

in /etc/apache2/mods-enabled#

lrwxrwxrwx 1 root root 29  3 mai    2022 php8.0.conf -> ../mods-available/php8.0.conf
lrwxrwxrwx 1 root root 29  3 mai    2022 php8.0.load -> ../mods-available/php8.0.load

in /etc/apache2/mods-available#

-rw-r--r-- 1 root root  855 21 avril  2022 php8.0.conf
-rw-r--r-- 1 root root  101 21 avril  2022 php8.0.load
-rw-r--r-- 1 root root  998 15 août   2022 php8.1.conf
-rw-r--r-- 1 root root  101 22 avril  2022 php8.1.load

so maybe php 8.1 isn’t loaded, how do I make the change?

Thank you.

Please provide the echoes of:

dpkg -l | awk '/^ii.*php/ {print $2}'

and

sudo apachectl -M 2>/dev/null | grep mpm

and

sudo apachectl -tD DUMP_INCLUDES 2>/dev/null | grep -v sites | sed -n '/php.*conf/ s#.*/\([^/]*\)\.conf#\1#p'

Much luck,
ernolf

here is the requested informations

dpkg -l | awk '/^ii.*php/ {print $2}'

libapache2-mod-php8.0
libapache2-mod-php8.1
php-common
php8.0-apcu
php8.0-bcmath
php8.0-cli
php8.0-common
php8.0-curl
php8.0-gd
php8.0-gmp
php8.0-igbinary
php8.0-imagick
php8.0-intl
php8.0-ldap
php8.0-mbstring
php8.0-mysql
php8.0-opcache
php8.0-readline
php8.0-redis
php8.0-xml
php8.0-zip
php8.1-apcu
php8.1-bcmath
php8.1-cli
php8.1-common
php8.1-curl
php8.1-gd
php8.1-gmp
php8.1-igbinary
php8.1-imagick
php8.1-intl
php8.1-ldap
php8.1-mbstring
php8.1-mysql
php8.1-opcache
php8.1-readline
php8.1-redis
php8.1-xml
php8.1-zip
apachectl -M 2>/dev/null | grep mpm

mpm_prefork_module (shared)

and

apachectl -tD DUMP_INCLUDES 2>/dev/null | grep -v sites | sed -n '/php.*conf/ s#.*/\([^/]*\)\.conf#\1#p'

php8.0

thank you in advance for your help

Thats the culprit, your Apache is still talking with php8.0

You could go trough all php related link groups and switch them all to 8.1 manual (not auto)

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

and/or

sudo apt-get reinstall libapache2-mod-php8.1

and/or remove the complete php8.0 if nothing relies on it

sudo apt-get purge *php8.0*

and finaly

sudo apachectl restart

Much luck,
ernolf

Thank you very much for your help

Unfortunately, your procedure crashed Nextcloud, so I had to improvise another solution.

here’s what I did:

sudo -u www-data php occ maintenance:mode --on
apt-get reinstall libapache2-mod-php8.1
a2enmod php8.1
a2dismod php8.0
systemctl restart apache2
sudo -u www-data php occ maintenance:mode --off

and now I just have to uninstall php 8.0.

Now I don’t get any error messages at all in nextcloud

Once again, thank you for your help