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:

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

Blockquote

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
3 Likes

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`.

1 Like

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.

2 Likes

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)

16 Likes

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.

It worked! Thank you very much!
On Ubuntu 20.04 apc.enable_cli=1 did not fix occ when in
/etc/php/<version>/php.ini
/etc/php/<version>/fpm/php.ini
/etc/php/<version>/apache/php.ini
/etc/php/<version>/cli/php.ini

Only your suggestion to add it in /etc/php/{{ php_version }}/mods-available/apcu.ini worked!

4 Likes

Hello! I saw your reply and didn’t get to check the other files, but I added it to my instance running on Debian Bullseye with PHP 7.4. Now I’m able to run occ to fix my missing indices :smiley: many thanks

I concurrd this worked for me too. I am completing the last steps of Nextcloud installation to fix below two issues:

  • Your web server is not properly set up to resolve “/.well-known/caldav”. Further information can be found in the documentation :arrow_upper_right:.
  • Your web server is not properly set up to resolve “/.well-known/carddav”. Further information can be found in the documentation :arrow_upper_right:.

And the tutorial that I am following is here:

My system is Ubuntu 20.04 and my PHP version is 7.4

Thanks, this works for me also, but before I need to install sudo apt-get install php7.4-apcu
without this nothing work.

Thank you, this solved my problem (after many days). One note I will add; I had to change the apcu.ini file in both the version 7.4 and 8.1 folders, even though I only have php7.4 enabled. Not sure why but adding the apc.enable_cli=1 line to both apcu.ini files solved the problem

You saved my evening…thanks!

worked for me with php 74
but not for php80

Also had to include

extension = apcu.so

[apc]
apc.shm_size = 512M
apc.enable_cli = 1

in php80/cli/conf.d/user_settings.ini
and made it readable for user http resp. www-data (or better all)

(BTW the flag --define apc.enable_cli=1 never worked for me)

2 Likes