Version 24.0.1 | Not able to using PHP Memory Cache and Cron job at the same time

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 24.0.1
Operating system and version (eg, Ubuntu 20.04): Synology DSM 7.1
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.51
PHP version (eg, 7.4): 7.4

The issue you are facing:

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

Steps to replicate it:

  1. insert ‘memcache.local’ => '\OC\Memcache\APCu‘, into config.ini
  2. run cron.php or occ command
  3. Getting error message: OCP\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)

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

<?php
$CONFIG = array (
  'instanceid' => '**********',
  'passwordsalt' => '*************',
  'secret' => '****************',
  'trusted_domains' =>
  array (
    0 => 'nextcloud.domain.com',
  ),
  'datadirectory' => '/volume1/web/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '24.0.1.1',
  'overwrite.cli.url' => 'https://nextcloud.domain.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => '********',
  'installed' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_from_address' => 'admin',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_domain' => 'domain.com',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.isp.com',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'internal.notifications@domain.com',
  'mail_smtppassword' => '***********',
  'default_phone_region' => 'DE',
  'default_language' => 'de',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.secret' => '****************************',
);

The commands

sh-4.4# sudo -u http php74 --define apc.enable_cli=1 occ db:add-missing-indices

and

sh-4.4# sudo -u http php74 -d apc.enable_cli=1 -f /volume1/web/nextcloud/cron.php

or

sh-4.4# sudo -u http php74 -f /volume1/web/nextcloud/cron.php

only work with disabled “memcache.local (…)” in config.php
When line is disabled in config.php I got a cache warning

“No memory cache has been configured. To enhance your performance please configure a memcache if available.”

How can I use Cron jobs and the PHP memory Cache together?

Best regards.

You can try running this command
sudo -u http php74 -d memory_limit=512M /volume1/web/nextcloud/cron.php

if that works you can create a cronjob for it

I’m using Nextcloud docker on Syno NAS, and made a task for it

1 Like