[Solved] Nextcloud 23 and Php 8.1.2 breaks cron.php

I’m running NC 23 on Rasperry Pi 4. It has been and continues to run great. Today, when I navigated to overview nextcloud runs the Security and setup scan. I noticed a strange message I’ve never seen before.

Last background job execution ran 14 days ago. Something seems wrong.

I checked the log and it’s clean. Nothing to see here.

So, I manually run the cron.php command from the command line with:
sudo -u www-data php -f /var/www/nextcloud/cron.php

and it doesn’t run at all. It outputs this message:

This version of Nextcloud is not compatible with > PHP 8.0.
You are currently running 8.1.2.

I regularly run updates on my system and at some point 14 days ago php must have updated and this has completely broken the nextcloud cron.php from running backup jobs.

Interestingly, my nextcloud instance seems to be running fine. It’s just cron.php that is broken so none of my background jobs are being run and it is recommended that they be run every 5 mins.

I don’t know how to fix this. Hoping someone can help.

Thank you!


Solved with the following workaround. Fortunately it’s an easy fix. Change the preferred version of php to the system.

Here’s how I did it:

run php -v
and it will show php 8.1 as the default version.

sudo update-alternatives --config php

and select the number corresponding to php 8.0

run php -v again to verify and it will show php 8.0 is now default. Restart php services and test.

Now cron.php is working again.

Devs are aware of this per Support PHP8.1 · Issue #29287 · nextcloud/server · GitHub

From devs, "Just downgrade/avoid 8.1, sit down and wait. That’s what we need to do for now - and it works fine :wink:


Thank You. Such a simple solution.

thanks a lot, had the same issue and your solution saved my day!