Cron not running in NC 21.0.3

I updraged NC 21.0.2 to NC 21.0.3 and the Cron stopped working. Actually the Cron gets executed but NC still tells that it haven’t run for x minutes. Executing the Cron on the command line (sudo -u http php74 /var/services/web/nextcloud/cron.php) does not generate any error. There is no error in nc log, apache error log or access log. The command gets executed immediately.

If I disable memcache.local in the NC config, the execution takes a few seconds and the cron is actually executed and NC shows that the cron ran this moment.

Nextcloud version (eg, 20.0.5): working: 21.0.2, not working 21.0.3
Operating system and version (eg, Ubuntu 20.04): Linux (Synology DSM)
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4
PHP version (eg, 7.4): 7.4 (tried also 7.3 on the cli)

The issue you are facing:
See description above

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Update to NC 21.0.3
  2. Execute nextcloud/cron.php
  3. Check admin area if cron got executed

The output of your Nextcloud log in Admin > Logging:


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'X',
  'passwordsalt' => 'X',
  'secret' => 'X',
  'trusted_domains' =>
  array (
  'datadirectory' => '/volume1/ncData',
  'overwrite.cli.url' => 'X',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'X',
  'dbhost' => 'X:3307',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'X',
  'dbpassword' => 'X',
  'logtimezone' => 'Europe/Berlin',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'X',
  'loglevel' => 2,
  'updater.server.url' => '',
  'maintenance' => false,
  'theme' => '',
  'htaccess.RewriteBase' => '/',
  '' => 'stable',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'X',
    'port' => 6379,
    'timeout' => 0,
    'password' => '',
    'dbindex' => 0,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'X',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'X',
  'mail_smtppassword' => 'X',
  'mysql.utf8mb4' => true,
  'app_install_overwrite' =>
  array (
    0 => 'calendar',
  'default_phone_region' => 'AT',
  'updater.secret' => 'X',

The output of your Apache/nginx/system log in /var/log/____:


Cannot confirm.
Just upgraded to v21.03 as well and cron is still working.

1 Like

Hi @Thor

Are you by any chance using the PHP repos from Sury? I had a similar problem this morning. There were updates for PHP7.4 packages available. After I upgraded them I also did the Upgrade of my Nextcloud to 21.0.3. Somehow the update of the PHP packages must have changed the PHP settings. I took the radical route and uninstalled PHP with “apt purge php*” and then reinstalled and configured it again.

However, I would first check whether the PHP-apcu module is still installed and active and the following lines are still present in… /etc/php/7.4/mods-available/apcu.ini

Hope that helps.



I have the same problem.

It seems like the problem is related to Sury as @bb77 said. I looked in the file /etc/php/7.4/mods-available/apcu.ini and apc.enable_cli=1 was missing. After i manually added it and restarted both php7.4-fpm and apache2 then cron started to work for me.

Thank you for the help @bb77


This is definitely an issue occurring to at least some people, as I too had the same thing happen. As with @andreasli, the suggestion by @bb77 fixed my issue as well. Thank you!


Same problem, but with nginx.
Thanks to @bb77
Manually added apc.enable_cli=1 and restart php7.4-fpm with nginx


I can confirm the above described issue for:

Nextcloud 21.0.3 (after upgrade from 21.0.2)
Debian 10.10 Buster
Apache 2.4
PHP 7.3.27

Thanks to @bb77 for the explain and reminding one to heed the admin settings. However, this did NOT fix my issue. All settings in place.

On my machine there is a condition not mentioned above:

$ sudo -u www-data php /var/www/nextcloud/occ  maintenance:repair
An unhandled exception has been thrown:
OC\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)

No such issue in any version before 21.0.3.

1 Like

Please see 21.0.3 OC\HintException: Memcache \OC\Memcache\APCu not available · Issue #27781 · nextcloud/server · GitHub

Until there is a fix available from Nextcloud, you could call the php commands with the parameter --define apc.enable_cli=1 e.g.:

sudo -u www-data php --define apc.enable_cli=1  /var/www/nextcloud/occ  maintenance:repair

I don’t think Nextcloud can provide a fix here. I’m pretty sure that the problem was caused by the PHP upgrade. Unfortunately, I can’t tell you for sure if all PHP settings were actually reset during the updgrade, because I didn’t check them all. As I already mentioned, I completely uninstalled PHP including all configuration files, and then reinstalled all PHP packages and made all relavant settings for PHP again.

After I did that, my Nextcloud and the cronjobs ran normally again, which leads me the conclusion, that the error must be caused by a missing PHP module or a wrong / missing PHP configuration and not by Nextcloud.

Thx bb77

I got cron errors on dashboard, but backup ran by cron always working.

This happened to me after upgrade to 21.0.3.
Using apache2 server and sury repos on RPi4.
Before running backup (script) i set NC to maintenance mode. This morning i got the appropriate APCU-error.
Adding “apc.enable_cli=1” to “apcu.ini” has done it for me. All running as expected again.

1 Like

Please note on my machine there was not any upgrade or change to the PHP 7.3.27 installation or the settings provided. This configuration allowed all Nextcloud versions before 21.0.3 running without the a.m. issue.

This points at NC 21.0.3 and some PHP code issue, I presume. Your mileage may vary.

Thanks a lot. I highly appreciate your contribution.

Based on your example I was able to pride a FIX to the cron configuration as follows.
Adding --define apc.enable_cli=1 to the www-data crontab:

$ sudo crontab -u www-data -e

*/5  *  *  *  * php -f /var/www/nextcloud/cron.php --define apc.enable_cli=1

This solves the issue on my machine and the NC cron job is available again.

However, there should be a more general fix provided by the NC devs hopefully as mentioned by me to @b77 before.

Happy hacking.



the last Nextcloudupdates sucks… This was the reason, why i switched from OwnCloud to Nextcloud… :confused:

Anyway. Same Problem on Raspian (Debian) 10 with PHP 7.3 from the Repository.
This help:

after this, maybe you need also a reload of the Apache2 / Webserver like this one:
service apache2 reload
I’m not sure about it.

Thank You, Community!


Thanks to both @andrewheeler82 with 21.0.3 OC\HintException: Memcache \OC\Memcache\APCu not available · Issue #27781 · nextcloud/server · GitHub and @maysi2k and I sadly consent.

Apparently, the new Nextcloud policy is taking from big business now: “It’s not a bug it’s a feature.

The admin manual has been changed to reflect this change of design only recently, I presume. This seems to be an intentional change to the PHP coding in NC 22 and obviously was backported to NC 21.0.3 without any notice to the community. Please prove me wrong, but this is my picture after reading the below reports which are one month old.

If this is the case, this apparent negligence and way of change from Nextcloud would be especially hurting to community people like me who were running a stable NC environment for years.

I had this setting configured before, so somewhere this must have been communicated. This is also the reason why I assumed that the upgrade of the PHP packages caused the error, because I had already made this confiiguration change before.

I’m not a developer and don’t understand half of the linked GitHub threads :wink: But it seems to me that APCu should be abandoned as the local cache and that Redis should be used for local caching to avoid problems in the future… Correct me if I’m misinterpreting this…

I think it’s a problem with the 21.0.3 update. Nothing above helps for me.
I decided to restore a backup with V 21.0.2. This works fine again. The problems with the cron’s and APCu begun with the update to V21.0.3.

I have another NC server which I updated from 20.0.11 to 21.0.3. Here I have no such problems with Cron and APCu.

How can someone understand such behaviour…

Best regards

Adding apc.enable_cli=1 to /etc/php/8.0/mods-available/apcu.ini worked for me as well


Then the two servers are not configured identically.

Unfortunately, I can’t say exactly what the problem was in my case, because as I mentioned earlier, I updated the PHP packages and then immediately updated to NC 21.0.3. Either the update of the PHP packages or the update of the Nexcloud obviously changed something in the PHP configuration. However, since I document all my installation steps and configurations, I was able to solve the problem in 5 minutes by simply reconfiguring PHP.

I updated only NC, no PHP update or anything and the error occured.
I went back to NC 21.0.2 with a backup and now it workls fine again.

I did some tests. I did a fresh installation of 21.0.3 on a second DiskStation (another Firmware version) and as soon as I enabled APCu the cron stopped. I did then a dffresh installation of 21.0.2 and the croin stayed intact after enabling APCu.

Here is the solution for Synology:
Create the file /usr/local/etc/php74/cli/conf.d/user_settings.ini with following content:

extension =

apc.shm_size = 512M
apc.enable_cli = 1

Thx to the guys from the German Synology Forum.

1 Like