Nextcloud version (eg, 20.0.5): 25
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.54
PHP version (eg, 7.4): 8.1
The issue you are facing:
After fresh install with of Nextcloud 25 with Apache 2.4.54/php8.1 executing the cron.php via cronjob isn’t possible anymore. Some general php-setting in Apache seems to state php 8.2 which I actually avoided when installing php.
After executing
php -f /var/www/nextcloud/cron.php
the error message is:
“This version of Nextcloud is not compatible with PHP>=8.2. You are currently running 8.2.0.%”
Any ideas how I can tell the system that php8.1 is still available and supposed to be used for that job?
Is this the first time you’ve seen this error? (Y/N): Y
This executes the PHP CLI application with the given php file (crom.php).
However you have not explicitly choosen which php version to use, hence asks the system to use the PHP version of its choice (PHP is an alias which the system translates to the newest installed PHP CLI version on the host system). Usualy this is the newest version installed.
I think I had tried that and got an error message which I can’t remember. I retried it and now I get the following feedback:
Cannot load Zend OPcache - it was already loaded
ArgumentCountError: Too few arguments to function OCA\MediaDC\BackgroundJob\CollectorCleanupJob::construct(), 0 passed in /var/www/nextcloud/lib/private/BackgroundJob/JobList.php on line 304 and exactly 2 expected in /var/www/nextcloud/apps/mediadc/lib/BackgroundJob/CollectorCleanupJob.php:41
Stack trace: #0 /var/www/nextcloud/lib/private/BackgroundJob/JobList.php(304): OCA\MediaDC\BackgroundJob\CollectorCleanupJob->
construct() #1 /var/www/nextcloud/lib/private/BackgroundJob/JobList.php(243): OC\BackgroundJob\JobList->buildJob() #2 /var/www/nextcloud/cron.php(145): OC\BackgroundJob\JobList->getNext() #3 {main}
@Kerasit@ajay69@Palerm : I have precisely this same problem it seems. I have been able to follow all suggestions in this thread, and I still get no success. Cron for background jobs just will not execute. Ajax though works fine.
I’m on v25.0.4 Ubuntu server 22.10.
Only fail I can see so far, that might be adressed, is I keep getting instructions to write the cronjob file as:
*/5 * * * * /usr/bin/php8.1 -f /var/www/nextcloud/cron.php
However there is no folder called “php8.1” in /usr/bin/ directory. There’s just a file called php8.1, but no folder. Makes me suspect something might’ve turned out bad with the php installation. However everything else on the server works 100%, tried it out pretty good.
I have also tried writing the cronjob in many different variations, like:
*/5 * * * * php -f /var/www/nextcloud/cron.php
*/5 * * * * php8.1 -f /var/www/nextcloud/cron.php
etc and I reboot the computer each time and wait at least 15 minutes before checking if it works. And yes I have changed the sudo update-alternatives option described above.
So I’m not sure what to make of it, and I have no further options to try from now
Would really appreciate some educated suggestions.
@Kerasit . Thank you for offering help.
I decided to create my own thread about it, where I outline alot of what I have done already.
If you care to check in there: