Since the release of Nextcloud 21.0.0, there have been increasing reports that cron and occ commands can no longer be executed. For once, these issues were not limited to Synology DiskStations or DSM. Since release 21.0.2, the error has disappeared for some users, but it persists for others. With 21.0.3 there were some changes that were actually intended for Nextcloud 22, but were quietly and secretly made for 21 as well.
If you let the server’s cron – in the case of the DisksStation this is the task scheduler – execute Nextclouds cron, it will no longer be executed. You get no error messages (at least from 21.0.3) calling cron.php works, but it doesn’t do what it’s supposed to do. Some users have already found that the cron works again if you remove the
memcache.local line from the Nextcloud config.
By default, PHP caching (APCu) is disabled on the command line. If you’ve read my articles, you might remember that we enabled PHP caching in the PHP profile for Nextcloud. Since the missing caching causes problems with Nextcloud’s cron in some cases, it was decided simply not to run the cron if APCu is deactivated. If you look at the Nextcloud documentation, it suddenly says:
“APCu is disabled by default on CLI which could cause issues with nextcloud’s cron jobs. Please make sure you set the
1 on your
php.ini config file or append
--define apc.enable_cli=1 to the cron job call.”
For Synology DiskStations, the question now arises again, where is the right place for the changes. The variable
apc.enable_cli is found in the PHP profile. But setting it to 1 doesn’t solve the problem. The PHP profile only applies to the web server, and APCu works there. But we want APCu on the command line.
To fix the problem, create the file
/usr/local/etc/phpXX/cli/conf.d/user_settings.ini using e.g. PuTTY and add the following content there:
extension = apcu.so [apc] apc.shm_size = 512M apc.enable_cli = 1
Save and close the file. Now you have to set the correct permissions, otherwise it won’t work:
chmod -R 644 /usr/local/etc/phpXX/cli/conf.d/user_settings.ini
Many thanks to everyone from the German Synology Forum who have also been looking for a solution and especially to those who have put things together.