APCu not available for local cache but tried everything / no backend warning / PHP 8.3.15

I tried everything, for hours…

The Basics

  • Nextcloud Server version:
    • Nextcloud Hub 9 (30.0.4)
  • Operating system and version (e.g., Ubuntu 24.04):
    • Ubuntu 22.04
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.52 (Ubuntu)
  • PHP version (e.g, 8.3):
    • PHP 8.3.15
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • nextcloud installation
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • down know, downloaded and unzip
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • don't know

Summary of the issue you are facing:

Hello, I tried almost everything and finally get rid of the warning in the backend. But still cannot use occ commands:

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

Steps to replicate it (hint: details matter!):

  1. Install NC
  2. Try to enable APCu
  3. try occ command

Log entries

Nextcloud

nothing in log file

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

  'installed' => true,
  'maintenance_window_start' => 1,
  'maintenance' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),

Apps

The output of occ app:list (if possible).#
error using occ

Any solutions?

I can use occ commands when I remove line in NC config.php:
‘memcache.local’ => ‘\OC\Memcache\APCu’,

update:
I tried also:

/etc/php/8.3/fpm/php.ini:
        extension = apcu.so
/etc/php/8.3/apache2/php.ini : 
      apc.enable_cli=1
      redis.session.locking_enabled=1
      redis.session.lock_retries=-1
      redis.session.lock_wait_time=10000
systemctl restart apache2 && systemctl restart redis-server

Additional Info:
I had some 8.4 default on command line. I deleted it. Now:

# update-alternatives --config php
There is only one alternative in link group php (providing /usr/bin/php): /usr/bin/php8.3

also phpinfo:

|apc.enable_cli|On
|apc.enabled|On

Thank you!

What does this tells you?

php -m | grep apcu

Hello

 # php -m | grep apcu
apcu

# php -v
PHP 8.3.15 (cli)

# phpinfo apache = 8.3.15

# ls -lh /etc/php/8.3/cli/conf.d/ | grep apcu
lrwxrwxrwx 1 root root 36 Jan  8 21:22 20-apcu.ini -> /etc/php/8.3/mods-available/apcu.ini

I can use occ commands when I remove line:
‘memcache.local’ => ‘\OC\Memcache\APCu’,

You tried not everything, you missed the last one:

Solution:
nano /etc/php/8.3/cli/conf.d/20-apcu.ini
→ apc.enable_cli=1

Found:

Not in NC documentation:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html

It is in there. You’re looking at the docs for the upcoming v31 however (where things have changed).

Check the stable docs (for v30):

https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/caching_configuration.html#id1

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.