Cron is Not Working Nextcloud 25

I have installed Nextcloud 25 on apache running on Ubuntu 20.04 server
everything looks good but the cron is not working
I have configured everything as Documentation

Please help me to solve this issue

1 Like

Can you run this from command line?
sudo -u www-data php -f /var/www/nextcloud/cron.php

(that is the command the cronjob will run, executing on the command line will directly show the errors)

2 Likes

It would really help if you fill out the support post template. Otherwise it’s hard to do much beyond tell you to re-check your work.

Dear tflidd,

Thank you for your response.
Here is the response of the above command

Dear Karl,

I have followed all the procedure as per the documentation but I am not be able to find the solution of this issue


It says that you don’t have APCu. Did you install it?

https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/caching_configuration.html

Dear tflidd,

I have installed APCu and configured on the config.php also
please find the snapshots for the reference

image

Did you enable apc inside php.ini as well?

Yes i did

Can you verify that apc / apcu is correctly installed? please check php -m to check installed php modules.

Dear Michael,

Please find the output
image

What does your cron job look like?

This is my crontab

depending on your distro cron does not have a full environment. try using the full path to the php-executable in the cronjob; on debian it’s /usr/bin/php
GOOD LUCK!

1 Like

Thank you for the response…

I see that you have write in your php.ini apc.enable_cli = 1 with blank spaces. Have you try it without those blank spaces?:
apc.enable_cli=1

Also, this could be a stupid question, but have you upgrade your php version? In my case, I was having an issue with cron after upgrading from php 7.4 to 8.0 and I solved it using the command like:
*/5 * * * * php8.0 -f /var/www/nextcloud/cron.php
instead of:
*/5 * * * * php -f /var/www/nextcloud/cron.php

I hope it helps.

1 Like

Shouldn’t the cronjob be executed as www-data user?
Something like sudo -u www-data php /var/www/nextcloud/cron.php

1 Like

Thank you all!!!

My issue has been resolved.
I have made a changed a bit and it have me full resolution

1 Like

This tip was in one of the notes in the documentation:
https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/background_jobs_configuration.html#cron

Therefore it is important to give all the details in the beginning, I though you have already tried that…

Sorry i am new in this and i thought it was optional