What the message looks like
Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)Common causes
apc.enable_cliis not set to 1 in the CLI configuration (default is 0).php-apcuinstalled only for FPM, not for the CLI version.- occ runs with a different PHP version than the web server, e.g.
phppoints to 8.1 while FPM uses 8.3. - config.php names APCu but the module was never installed.
Check
- Check that the CLI loads the module
php -m | grep -i apcu - Show apc.enable_cli and the CLI's loaded php.ini
php -i | grep -E 'apc.enable_cli|Loaded Configuration File' - Show the configured local cache
sudo -u www-data php /var/www/nextcloud/occ config:system:get memcache.local - Search existing entries in the CLI configuration
grep -r 'apc.enable_cli' /etc/php/*/cli/
Fix
- Add
apc.enable_cli=1to/etc/php/8.3/mods-available/apcu.ini. - Install the missing module:
apt install php8.3-apcu– matching the PHP version in use. - Call occ and cron with the right version, e.g.
php8.3 occandphp8.3 -f cron.php. - No APCu possible? Use
'memcache.local' => '\OC\Memcache\Redis'instead. - Then check with
occ statusthat the message is gone.
Typical scenario
The web interface works fine, but every cron run and every occ call ends with 'Memcache \OC\Memcache\APCu not available for local cache'. config.php sets memcache.local to APCu and the PHP module is installed. The reason: PHP-FPM and PHP-CLI read separate configurations. Use php -i | grep apc.enable_cli to check whether APCu is enabled for the command line.
FAQ
Do I need to restart PHP-FPM?
Not for the CLI – it reads its config on every call. Only if you reinstall the module for FPM do you need to restart PHP-FPM.
Does this fix the cron job too?
Often, yes. cron.php aborts with the same message, and Nextcloud then reports stale background jobs.
Why does it work in the browser but not in the console?
The web server uses PHP-FPM with its own configuration, while occ and cron run on PHP-CLI with its own php.ini (on Debian, for example, /etc/php/8.3/cli). In CLI, APCu is disabled by default unless apc.enable_cli is set.
Do I need APCu if I use Redis?
They have different jobs. APCu serves as a local cache per server, Redis as a distributed cache and for file locking. The Nextcloud documentation recommends APCu as memcache.local and Redis for memcache.distributed and memcache.locking.
How do I make sure I edit the right PHP configuration?
php --ini shows which files the CLI loads. For FPM use php-fpm8.3 -i or run a phpinfo() page once. Then restart FPM; the CLI picks up changes immediately.