What upgrade first - NextCloudPi (from v1.52.1 to v1.52.2) or PHP (from 7.4.33 to 8.0)

Hello there,

I’m running NCP on a RaspberryPi with unattended auto updates. Since a week the app on my smartphone throws an 500 http error.
I connected to the server with the browser and got the information “This version of Nextcloud requires at least PHP 8.0
You are currently running 7.4.33. Please update your PHP version.”
As I logged in on the Pi i got the information “NextCloudPi v1.52.1 is outdated
update to v1.52.2 througt ‘ncp-config’ …”.
I nope now, that after updating the on or the other or both the problem will be solved and the http error 500 will disappear by magic.
But, what should I update first, the NextCloudPi or PHP? Or is the proper PHP version already included in NCP v1.52.2?
Maybe you think “what a stupid question” bot some versions before I updated ncp by 'ncp-config" that had also PHP problems and than the ncp installation was crashed and i had to ask a friend to fix it manually after months of unsuccessfull repair attempts.
So this time I want to make it right, because all the appointments and contacts of me, my wife and of the children are in the ncp so we need it up and running.
And if the first step is to update PHP, is there a foolproof instruction for ncp how to do it?
Thanks in advance and best regards

I’m confused how you ended up updating to >=NC26 without already upgrading PHP.

If you use ncp-update-nc you shouldn’t have to upgrade PHP yourself.

Anyhow, the upgrade of NCP from v1.52.1 to v1.52.2 is a tiny update to fix a backup/restore issue. You should be able to do it without regard to your current PHP version issue so I’d do it first.

But before doing anything else it might be worth sorting out how you ended up in your current state. NC should not have been updated. Maybe backtrack to when things stopped working (since that’s presumably when NC was upgraded) and see what’s in the logs.

Hello jtr, thank you for answering me so fast.
What should I show you and where can I find it? (Sorry, I’m not that Linux-Guru, in the most cases I reach my goals but the learning curve is each time very challenging)

Ok, so first I update to NCP v1.52.2. What next? Some services seem to be down, so that I cannot find the version of NC. Schloud I try to “update” NC to 25.0.6 as described in this post or will I run in unexpected problems regarding the wrong PHP version?

Ok, so in the last days the system updated to NCP v1.52.2 automatically. I took a look into ncp.log and see some trouble:
ncp.log:

[ nc-previews-auto ]
Di 18. Jul 06:25:04 CEST 2023 - Running /etc/cron.daily/ncp-autoupdate...
Downloading updates
Performing updates
"BACKUPHOUR"
Running nc-autoupdate-nc
[ nc-autoupdate-nc ] (Di 18. Jul 06:30:05 CEST 2023)
automatic Nextcloud updates enabled
automatic Nextcloud updates enabled

NextCloudPi updated to version v1.52.1
Cannot load Zend OPcache - it was already loaded
[ nc-update-nc-apps-auto ]
checking for updates...
notes new version available: 4.8.1
notes updated
[ncp-update-nc]
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Current   Nextcloud version 25.0.6.1
Available Nextcloud version 26.0.1
Download Nextcloud 26.0.1...
Back up current instance...
Cannot load Zend OPcache - it was already loaded
check free space...
Cannot load Zend OPcache - it was already loaded
Cannot load Zend OPcache - it was already loaded
Maintenance mode enabled
backup database...
backup files...
backup /var/www/nextcloud-bkp_20230718_1689654693.tar.gz generated
Cannot load Zend OPcache - it was already loaded
Maintenance mode disabled
Storing backup at '/var/www/nextcloud-bkp_20230718_1689654693-25.0.6.1.tar.gz'...
Install Nextcloud 26.0.1...
Restore data...
Fix permissions...
Upgrade...
Cannot load Zend OPcache - it was already loaded
This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.Abort
Clean up...
Rolling back to backup /var/www/nextcloud-bkp_20230718_1689654693-25.0.6.1.tar.gz...
stat: die Dateisysteminformation für '' kann nicht gelesen werden: Datei oder Verzeichnis nicht gefunden
Can only restore from ext/btrfs/zfs filesystems (found 'ext2/ext3
Rollback failed! Data left at /var/www/recovery/ncp-data.YP6bQZ


[ nc-previews-auto ]
This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.Mi 19. Jul 06:25:03 CEST 2023 - Running /etc/cron.daily/ncp-autoupdate...
[ nc-update-nc-apps-auto ]
checking for updates...
This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.
[ncp-update-nc]
Cannot load Zend OPcache - it was already loaded
Nextcloud is currently down


[ nc-previews-auto ]
This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.Do 20. Jul 06:25:02 CEST 2023 - Running /etc/cron.daily/ncp-autoupdate...
[ nc-update-nc-apps-auto ]
checking for updates...
This version of Nextcloud requires at least PHP 8.0<br/>You are currently running 7.4.33. Please update your PHP version.
[ncp-update-nc]
Cannot load Zend OPcache - it was already loaded
Nextcloud is currently down

[ nc-limits ] (Do 20. Jul 19:44:42 CEST 2023)
Using 768M for PHP max memory
Installing template 'php/90-ncp.ini.sh'...
Using 16 PHP threads
Installing template 'php/pool.d.www.conf.sh'...
Installing template 'mysql/91-ncp.cnf.sh'...

[ nc-info ] (Do 20. Jul 20:42:13 CEST 2023)
Gathering information...
Cannot load Zend OPcache - it was already loaded
NextcloudPi version  v1.52.1
NextcloudPi image    NextCloudPi_10-08-21
OS                   Debian GNU/Linux 11. 5.15.61-v8+ (aarch64)
automount            yes
USB devices          sda 
datadir              /var/www/nextcloud/data (doesn't exist)
rootfs usage         9,7G/59G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      error
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          down
Postfix service      up
Internet check       ok
Public IPv4          XX.XX.XX.XX
Public IPv6          not found
Port 80              open
Port 443             open
IP                   XXX.XXX.XXX.XX
Gateway              XXX.XXX.XXX.X
Interface            XXXXXXXXXXXXXXX
Certificates         XXXXXXXXX.hopto.org
NAT loopback         no
Uptime               58min

I think there is a lot of trouble …
What should I do next?

  1. Install PHP 8.0?
    1.1) How to do that properly?
    1.2) Is this a good HowTo to do the update?
  2. Than installing NextCloud 26.0.1 by using ncp-config?

Thanks for your help in advance …

Afaik you need to update Nextcloud to? 25.0.6 first (probably must be done through ncp-config cli) and after that update to 26.0.x this way you get php 8.1 before you install a version of nextcloud that requires it…

Thank you for the fast answer. As you can see in the ncp.log i already run NextCloud 25.0.6.1 and the upgrade to NextCloud 26.0.1 failed because there was no PHP 8.0. The rollback was not successful, because the usb drive, where the backups are stored, has an unsupported file system (ext3 instead of zfs or btrfs …). So I ended up with an not working NextCloud.
So I think I have to update the PHP first (manually). If I am wrong, so please tell me what to do, before I send my NextCloud by unsuccessful repair attempts forever into nirvana.

So do you have a working backup to go back to?
You might find the solution in tgis thread helpfull

Or even in my thread i have linked there…

What i did to get everything back working was a fresh install of NCP, set up everything and then restore the NC-Backup and update that to 26.0.1
Then i had to manage to switch to the correct php version in apache2 and cli and i was save.

Ok, so here we are:

  1. I rolled back a backup:
    – With sudo mc I started the midnight commander and changed the latest backup file to r/w for everyone (chmod).
    – By using mc I copied the backup file from my not supported USB drive to the SD card into the path /home/pi/ (seems to be the right fs).
    – I restored to a running NC instance (sudo nc-config) from the backup file to prevent unexpacted side effects while updating NC later.
  2. I updated php from 7.4 to 8.0 using this and this tutorial:
    – The first tutorial showed an unexpected error, something about certificates, so i decided to continue with the second tutorial.
    – The second tutorial left me with a merg of php 8.0 and 8.2. I am not sure if it was a consequenc of starting the php update with tutorial one and continuing with tutorial two.
    – As i run php -v I got the info that php 8.2 was installed and my running NC 25.0.6.1 stopped.
    – With dpkg -l | grep php | tee php.txt i saw that I had some php8.2 components installed.
    – With apt remove I uninstalled php8.2-common and php8.2-cli and installed the 8.0 versions and restartet php and the apache as described in tutorial two.
    – Running php -v showed now php 8.0.X.
  3. Updating to NC26.0:
    – The update to N26.0 was possible now by using nc-config again, but i had to update to 25.0.7 first.

Now everything is up and running, despite of php8.0-imagick, I couldn’t get it to run, but it is only for rendering of images, so I hope i will not need it by now. All that took me 12 to 15 hours, because I had to read and learn a lot again. Hopefully i will remember the learned stuff for the next catastrophy …
And yes, I fixed the problem with my USB-drive for backups.
Problem solved

1 Like

Hey there.
One more question left:
Should I remove the (hopefully) obsolete php 7.4 and php 8.2 parts by using apt purge '^php7.*' and apt purge '^php8.2*' ? I noticed a strange behavior in some cases. For example the ports 80 and 443 are shown closed in the info, but are open. I checked it by using let’s encrypt. The renewal of the certificates was successful, but I got the information that redis went away. As I use dpkg -l | grep php | tee php.txt I get the following output:

ii  php-common                          2:76                                          all          Common files for PHP packages
rc  php-igbinary                        3.2.14-1+0~20230618.45+debian11~1.gbpcc1dca   arm64        igbinary PHP serializer
rc  php-redis                           5.3.7++-1+0~20230619.51+debian11~1.gbp4ff337  arm64        PHP extension for interfacing with Redis
rc  php7.3-common                       7.3.31-1~deb10u1                              arm64        documentation, examples and common module for PHP
rc  php7.3-readline                     7.3.31-1~deb10u1                              arm64        readline module for PHP
ii  php7.4                              7.4.33-1+deb11u4                              all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.4-bcmath                       7.4.33-1+deb11u4                              arm64        Bcmath module for PHP
ii  php7.4-bz2                          7.4.33-1+deb11u4                              arm64        bzip2 module for PHP
ii  php7.4-cli                          7.4.33-1+deb11u4                              arm64        command-line interpreter for the PHP scripting language
ii  php7.4-common                       7.4.33-1+deb11u4                              arm64        documentation, examples and common module for PHP
ii  php7.4-curl                         7.4.33-1+deb11u4                              arm64        CURL module for PHP
ii  php7.4-fpm                          7.4.33-1+deb11u4                              arm64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.4-gd                           7.4.33-1+deb11u4                              arm64        GD module for PHP
ii  php7.4-gmp                          7.4.33-1+deb11u4                              arm64        GMP module for PHP
ii  php7.4-intl                         7.4.33-1+deb11u4                              arm64        Internationalisation module for PHP
ii  php7.4-json                         7.4.33-1+deb11u4                              arm64        JSON module for PHP
ii  php7.4-ldap                         7.4.33-1+deb11u4                              arm64        LDAP module for PHP
ii  php7.4-mbstring                     7.4.33-1+deb11u4                              arm64        MBSTRING module for PHP
ii  php7.4-mysql                        7.4.33-1+deb11u4                              arm64        MySQL module for PHP
ii  php7.4-opcache                      7.4.33-1+deb11u4                              arm64        Zend OpCache module for PHP
ii  php7.4-readline                     7.4.33-1+deb11u4                              arm64        readline module for PHP
ii  php7.4-xml                          7.4.33-1+deb11u4                              arm64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php7.4-zip                          7.4.33-1+deb11u4                              arm64        Zip module for PHP
ii  php8.0-bcmath                       1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        Bcmath module for PHP
ii  php8.0-cli                          1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        command-line interpreter for the PHP scripting language
ii  php8.0-common                       1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        documentation, examples and common module for PHP
ii  php8.0-curl                         1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        CURL module for PHP
ii  php8.0-fpm                          1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php8.0-gd                           1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        GD module for PHP
ii  php8.0-gmp                          1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        GMP module for PHP
ii  php8.0-igbinary                     3.2.14-1+0~20230618.45+debian11~1.gbpcc1dca   arm64        igbinary PHP serializer
ii  php8.0-imagick                      3.7.0-4+0~20230701.41+debian11~1.gbpbf7e27    arm64        Provides a wrapper to the ImageMagick library
ii  php8.0-intl                         1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        Internationalisation module for PHP
ii  php8.0-mbstring                     1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        MBSTRING module for PHP
ii  php8.0-mysql                        1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        MySQL module for PHP
ii  php8.0-opcache                      1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        Zend OpCache module for PHP
ii  php8.0-readline                     1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        readline module for PHP
ii  php8.0-redis                        5.3.7++-1+0~20230619.51+debian11~1.gbp4ff337  arm64        PHP extension for interfacing with Redis
ii  php8.0-xml                          1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php8.0-zip                          1:8.0.29-1+0~20230609.54+debian11~1.gbp7b07ff arm64        Zip module for PHP
rc  php8.2-cli                          8.2.8-1+0~20230716.25+debian11~1.gbp5cf2f6    arm64        command-line interpreter for the PHP scripting language
rc  php8.2-common                       8.2.8-1+0~20230716.25+debian11~1.gbp5cf2f6    arm64        documentation, examples and common module for PHP
rc  php8.2-igbinary                     3.2.14-1+0~20230618.45+debian11~1.gbpcc1dca   arm64        igbinary PHP serializer
rc  php8.2-opcache                      8.2.8-1+0~20230716.25+debian11~1.gbp5cf2f6    arm64        Zend OpCache module for PHP
rc  php8.2-phpdbg                       8.2.8-1+0~20230716.25+debian11~1.gbp5cf2f6    arm64        server-side, HTML-embedded scripting language (PHPDBG binary)
rc  php8.2-readline                     8.2.8-1+0~20230716.25+debian11~1.gbp5cf2f6    arm64        readline module for PHP
rc  php8.2-redis                        5.3.7++-1+0~20230619.51+debian11~1.gbp4ff337  arm64        PHP extension for interfacing with Redis

Or should I better install php 8.2 and purge everything below php8.2? Is there a usable tutorial how to install php8.2? I am running currently NC 26.0.3.2.

Afaik NC 26.x does not support PHP 8.2, you can however run it on? 8.1.
If you update to 27.x it will work with 8.2, but id suggest to wait a bit as 27.0.1 seems to have webdav issues for some reason.

OK. But what about my PHP mix of 7.3, 7.4, 8.0 and 8.2? How to clean it up without damaging the system? Or shloud I start a new thread?

Once you are sure you run on php8.1 or 8.0 you can do something like

sudo apt-get purge php7.*

*sorry if the command is not 100% correct i am writing from train…

Which will uninstall all php7.x versions

I have now btw updated successfully to a working 27.0.2 via ncp updater, just for info… the problem i had with 7.0.1 may have been caused by a problem with ths ncp updater, whixh is fixed in 1.52.4