OCC won't run with memcache/apcu

Nextcloud 21 is installed and running perfectly. Not even a single error message.

  • ‘memcache.local’ => ‘\OC\Memcache\APCu’ is in the config/config.php
  • apc.enable_cl`=1 is in the php.ini
  • opcache.enable_cli=1 is in the php.ini
  • On the web, Settings-Overview shows no error

But when I try to run the OCC via the command line, I get:

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?)


packages memcached php-memcached php-apcu are installed.

What am I missing?

Thank you.

What is your operating system and how did you install nextcloud? The necessary packages may vary depending on the os version.

Use the parameter --define apc.enable_cli=1 for php. e.g.:

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

For me, I was adding apc.enable flag to the wrong php.ini file. The one that should be used is within the cli folder (/etc/php/7.3/cli/php.ini) not the one in fpm folder (/etc/php/7.3/fpm/php.ini).

Also you mistyped apc.enable_cli as apc.enable_cl`.

Same error on Nextcloud 21.0.3.
I disabeld apcu in config/config.php.
After Update to Nextcloud 22.0.0 i activated it again and it works.

Thanks, this solved my occ acpu issue as well

I put apc.enable_cli=1 in /etc/php/{{ php_version }}/mods-available/apcu.ini and it worked. ({{ php_version }} == 7.4/8.0)


this worked for me, thanks

Thanks to indicate the path /etc/php/{{ php_version }}/mods-available/apcu.ini.
It works for me !

It worked, thank you!

Man, you are my savior. Thx a lot

You made my day. Using the parameter I could finish the update form 21.0.1 to 21.0.4.