Hold on PHP 8.1 After PHP8.2 Upgrade Yesterday

My NCP instance on RPi failed this morning, showing me below after login:

Service Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

There isn鈥檛 any scheduled backup job running hence I felt confused. I first cleaned the opcache as told in NCP Update to v.1.50.0 fails to 503. I could login again!

Then I found a big red warning listing in Settings - Overview page saying the background job isn鈥檛 running. Upon examining the crontab, it quickly became obvious that the system was pointing php to php8.2, which was not aligned with php-fpm8.1 that running NC.

Below is what I did to fix:

$ sudo update-alternatives --config php
There are 2 choices for the alternative php (providing /usr/bin/php).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/php8.2   82        auto mode
  1            /usr/bin/php8.1   81        manual mode
  2            /usr/bin/php8.2   82        manual mode

Press <enter> to keep the current choice[*], or type selection number: 1

dpkg log shows php8.2 came from auto-upgrade the day before via the repo of https://packages.sury.org/php/.

Anyway, hope my experience helps people who encountered similar issue from the upgrade yesterday.

EDIT: Spelling fix.

4 Likes

Consider using Docker instead :wink:

The overhead of running Docker may be too much for my old RPi 3+. When the inventory and pricing of RPi 4 becomes sane again in my region, I will consider Docker and perhaps even with Podman.

Same here, I noticed it鈥檚 trying to pull 24.0.5 and not 25.0.2 or 26. Is this project dying out?

Nothing is dying out @austinreed

Docker is being worked on, see Not seeing NC25 as update option - #19 by szaimen it also publishes a bit behind traditional server-package schedule on purpose (roll-out in waves for new major releases).

version 26 is currently being developed so don鈥檛 expect that any time soon, see current schedule: Maintenance and Release Schedule 路 nextcloud/server Wiki 路 GitHub

3 Likes

To get back to your issue. (And because I think docker isn鈥檛 the answer to everything).

Did you modify anything on your php modules and/or settings? Did you upgrade php manually at some point.
I鈥檓 asking because my instance is running on full autoupdates and I鈥檓 on php 8.1.10.

1 Like

The problem seems to be the php-json package on line 50 of the lamp.sh script. See here: NCP Script installiert immer php8.2.0 / Setup schl盲gt fehl - #2 by bb77

I don鈥檛 use NCP, but when I issue apt install php-json on my Debian 11 instance, on which I have the sury repos enabled, it tries to install multiple PHP8.2 packages:

Die folgenden zus盲tzlichen Pakete werden installiert:
  php8.2-cli php8.2-common php8.2-opcache php8.2-phpdbg php8.2-readline
Vorgeschlagene Pakete:
  php-pear
Die folgenden NEUEN Pakete werden installiert:
  php-json php8.2-cli php8.2-common php8.2-opcache php8.2-phpdbg
  php8.2-readline

So I would suggest someone should open a pull request, in order to remove the php-json package from the script, because this package is no longer needed for new installations with PHP >8.0, and I鈥檓 not sure, but I suspect it could also be the reason that some users suddenly have PHP8.2 installed, after they did an apt full-upgrade.

Is already on GH:

1 Like

apt install php8.1-json

This won鈥檛 work, because such a package doesn鈥檛 exist. As of version 8, json was integrated into the PHP core code and is no longer a separate module.

Ah now I understand the issue. Thanks.

Also, if you try to pin php-json or php-common NextCloud will install, you can upgrade the nc instance etc but occ /ncp throws errors about not supporting sqlite, nextcloud is not installed few commands available, and something about push failing. Sorry I re-imaged and slept since yesterday :slight_smile: Also, editing /usr/local/etc/ncp.cfg to allow 8.2 doesn鈥檛 seem to be a solution either.

Side note here, Nextcloud is working on PHP8.2 support, to come with Nextcloud 26, Nextcloud before version 26 (currently under development) is not compatible with PHP8.2 and expected to crash, so best to stick with the system requirements i.e. for version 25 which is PHP7.4, 8, 8.1 whith 7.4 being deprecated and 8.1 being recommended. It also makes sense to go for PHP8/8.1 so you will then be able to just update to Nextcloud 26 when it gets published because it will be 8.0/8.1/8.2

4 Likes

My dkpg.log showed that there鈥檚 a 8.2 version of php-json packaged installed:

2022-12-14 09:23:48 upgrade php-json:all 2:8.1+93+0~20221029.44+debian11~1.gbpaae3e9 2:8.2+93+0~20221211.45+debian11~1.gbpdb4dcc
2022-12-14 09:23:48 status half-configured php-json:all 2:8.1+93+0~20221029.44+debian11~1.gbpaae3e9
2022-12-14 09:23:48 status unpacked php-json:all 2:8.1+93+0~20221029.44+debian11~1.gbpaae3e9
2022-12-14 09:23:48 status half-installed php-json:all 2:8.1+93+0~20221029.44+debian11~1.gbpaae3e9
2022-12-14 09:23:48 status unpacked php-json:all 2:8.2+93+0~20221211.45+debian11~1.gbpdb4dcc

If it鈥檚 already integrated into core of PHP8, can I safely uninstall this sub-package?

$ sudo apt-cache show php-json
Package: php-json
Source: php-defaults (93+0~20221211.45+debian11~1.gbpdb4dcc)
Version: 2:8.2+93+0~20221211.45+debian11~1.gbpdb4dcc
Architecture: all
Maintainer: Debian PHP Maintainers <team+pkg-php@tracker.debian.org>
Installed-Size: 14
Depends: php-common, php8.2-json
Priority: optional
Section: php
Filename: pool/main/p/php-defaults/php-json_8.2+93+0~20221211.45+debian11~1.gbpdb4dcc_all.deb
Size: 7356
SHA256: 1d4173cde07205265f02ce882e39ffa3cc7b63c814f333934f8b422301e01e06
SHA1: 481d15e93e2d40698f0a5b1487e9b59b18cad3da
MD5sum: 9af69a4a659a38cecd805928092acd10
Description: JSON module for PHP [default]
 This package provides a JSON module for PHP.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 .
 This package is a dependency package, which depends on Debian's default
 PHP version (currently 8.2).
Description-md5: 079881a7332ddd567b908d4bdef5c1f2

Package: php-json
Source: php-defaults (76)
Version: 2:7.4+76
Installed-Size: 13
Maintainer: Debian PHP Maintainers <team+pkg-php@tracker.debian.org>
Architecture: all
Depends: php-common, php7.4-json
Description-en: JSON module for PHP [default]
 This package provides a JSON module for PHP.
 .
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 .
 This package is a dependency package, which depends on Debian's default
 PHP version (currently 7.4).
Description-md5: 75a773432d210a4dafb57ae2359918db
Section: php
Priority: optional
Filename: pool/main/p/php-defaults/php-json_7.4+76_all.deb
Size: 6364
MD5sum: 20de9c120408e5c8427bf4b15589f46e

The php8.x-json packages are virtual packages. They are probably needed for the update-alternatives mechanism to work, that allows you to manage multiple versions of PHP on the same system.

apt show php8.2-json
Package: php8.2-json
State: not a real package (virtual)
N: Can't select candidate version from package php8.2-json as it has no candidate
N: Can't select versions from package 'php8.2-json' as it is purely virtual
N: No packages found

When I explicitly install PHP 8.1 on a fresh instance, the php-json package doesn鈥檛 get installed, so if you are on PHP 8.0 or higher it should be safe to remove. But you can鈥檛 remove any of the php8.x-json packages, because as I wrote above, these are not real packages.

1 Like