How to update PHP to 8.x the right way?

Hi,

this is my system:

Raspberry Pi4
NCP: 1.52.3
Nextcloud: 25.0.6.1

For a few days when I want to login to my NextcloudPi I get the following error:

This version of Nextcloud requires at least PHP 8.0
You are currently running 7.4.33. Please update your PHP version.

First of all, why is PHP not updated together with the Nextcloud version? Since forever I have turned all automatic updates ON and not had any issues until now…

Second, there are probably a hundred different tutorials on how to update PHP and all of them differ a lot. Any hint on a noob-safe way to do this?

I tried php -v and it gave me the following output:

Cannot load Zend OPcache - it was already loaded
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

When trying to update Nexcloud manually, I get this error:

[ nc-update-nextcloud ] (Sun Jul 30 18:25:14 BST 2023)
Cannot load Zend OPcache - it was already loaded
Nextcloud is currently down

I got rid of the Zend OPcache error but now whenever I want to update through nc-update-nextcloud I still have the same error:

Nextcloud is currently down

Any hint on what went wrong here? What does it even mean? I can access through SSH and WEB-UI. But when I try to open the dashboard, it still gives me the following:

This version of Nextcloud requires at least PHP 8.0
You are currently running 7.4.33. Please update your PHP version.

There are no PHP 8.x packages installed.
/usr/local/etc/ncp.cfg shows:

"nextcloud_version": "25.0.6.1",
"php_version": "7.4",
"release": "bullseye"

Why do I get the error saying it needs PHP 8? Does 25.0.6.1 come with PHP 8 and the update didn’t work correctly?

As far as I understand things, NC will never update software like PHP by itself.
PHP would be updated if you update your OS. But there are traps to fall into there as NC tends to be compatible only with specific PHP versions, so you have to make sure you dont update PHP to a level too high.

This here seem a good tutorial for upgrading PHP manually:

also this here: NextCloud - PHP 7.x Update zu PHP 8.0 - Schritt für Schritt

Be aware that all this can turn out non-trivial and you should backup your system beforehand.

1 Like

@Gorf Thank you so much!

I read carefully through both of the tutorials and in the end I followed the first one because of the PPA for Bullseye.

My Nextcloud is up and running again and even seems snappier than before.

1 Like