PHP confusion after upgrading Raspbian Bullseye

Today I’ve upgraded my Bullseye on a raspi with dist-upgrade.
Now I get a message from cron as email “This version of Nextcloud is not compatible with PHP>=8.3. You are currently running 8.3.0.”
I definitely have no php 8.3 installed, php --version is reporting: PHP 8.2.13 (cli) (built: Nov 24 2023 13:10:01) (NTS)
In Nextcloud I can see under “System” : PHP 8.2.13 is used.

What goes wrong, and how can I suppress the cron-message?

PHP versions can differ between your webserver and cron.

Try running update-alternatives --config php and set the default php version there.

If that doesn’t do the trick, run which php8.2 and then update your cronjob with that version, e.g. /usr/bin/php8.2 /path/to/nc/cron.php

The automatic update from one to the next php-version is done by so called “dependency-packages” like ‘php ’ and other packages with names like php-{module} (without the version String) Those packages allways depend on the latest version (which is 8.3 at the moment) and can almost all safely be removed, what will give you back the control over your php-version. When you try to deinstall such a package, you will see if it is a dependency for one or more php8.2-* modules (like php-common which is allways needed). All other packages that don’t meet any dependencies can safely (and should) be removed.
A package as ‘php8.2 ’ is a so caled “meta-package” and can be removed as well.

Then you should only install the packages WITH version string (php8.2-{module} instead of php-{module}).

Then you should - as mentioned by @Dzrenner - do the update-alternatives, but not as in his suggestion only for the php linkgroup but for all php related linkgroups:

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

And here is a little more information about PHP in general:

You should look, which php-sapi (sapi = Server API) you are working with.

These are the most important sapis:

Command Line Interface

  • cli
  • package - php<VER>-cli
  • description:
    cli is used by php scripts invoked from the command line. i.e. all processes that were explicitly NOT called by the web server (cron jobs, occ commands, etc.)

Apache2 module

  • apache2
  • package - libapache2-mod-php<VER>
  • description:
    the apache2 module is the default sapi for apache2. The downside is that it’s not particularly scalable and doesn’t support http2. libapache2-mod-php relies on the old but stable Multi-Processing Module (MPM) “mpm-prefork”.

Fast Process Manager

  • fpm
  • package - php<VER>-fpm
  • description:
    this is the default sapi used by nginx. On apache2 php-fpm relies on the more scalable threaded MPM “mpm-event”. Additionally it needs the apache2-modules “proxy_fcgi” and “setenvif”.

Every sapi has its own php.ini file: /etc/php/<VER>/<SAPI>/php.ini

If your webserver is apache2, you can find out the active mpm (Multi Processing Module) with this command call:

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

as explained above, the “mpm_event_module” means that apache2 speaks via fpm, while the “mpm_prefork_module” indicates that the apache2 module is used for the comunication between webserver and php.

  • the sapi used by apache 2 can also be found out with this command call:
sudo apachectl -tD DUMP_INCLUDES 2>/dev/null | grep -v sites | sed -n '/php.*conf/ s#.*/\([^/]*\)\.conf#\1#p'
Explanation taken from php-updater script:

Much luck,
ernolf

1 Like

I ran into this error upon updating. I downgraded the php version. Everything is working fine.

However…

Exactly what is broken in NC when running 8.3 versus 8.2 ?

PHP8.3 is supported as of Nextcloud 28. Additionally a lot of apps still do not yet support 8.3.

Nextcloud tests the php version and gives out the warning or blocks the update of apps if the new version of that app does not yet support the php version in question (8.3).

There are some possibilities to bypass this behaviour but I would strongly disencourage that.

Much luck,
ernolf

I have NC28.01 running with php8.2 and mariadb. it’s working great. couple apps don’t work, but all of the official ones do.