Unhandled exception - OCP\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache

Hi Nextcloud community,

since I updated to NC 26.0.2, the following message appears on administration screen:

There are some warnings regarding your setup.

The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running “php81 occ db:add-missing-indices” those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster.

o Missing index “fs_parent” in table “oc_filecache”.

When I execute “occ db:add-missing-indices” the following error message appears.

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

Does anyone have any idea, how to solve this problem?

Thanks in advance.

Bfn
Michael

Heya Silvernerd,

Two things to check.

  1. php-apcu is actually installed, with correct version of PHP, eg php8.1-apcu
  2. You’ve enabled apcu for CLI commands too

The first one you can check with apt show php8.1-apcu or look in the Nextcloud administration:system settings which will show PHP version and extensions. I’ve forgotten this during a build once which is a bit embarrassing although nobody knew. Until now…

You also need to specifically enable the CLI to use APCu as well.

Edit the /etc/php/8.1/cli/php.ini file and add the following to the file. Somewhere at the beginning is good:

;;;;;;;;;;;;;;;;;;;
; Nextcloud Config

apc.enable_cli = 1

This is also needed for triggering cron.php via cron/systemd timer too.

I guess a crude workaround could also be to comment out the memcache.local entry in your [nextcloud base]/config/config.php file while you sort the upgrade. But that’s cheating. :wink:

Luck!

=R

2 Likes

Thank you for your response, RichardN.

Unfortunately, I only have a managed server. Thus, I have no direct access to files like /etc/php/8.1/cli/php.ini
i will forward your recommendations to my support team and come back, when there are any news.

Bfn
Michael

It worked like a charm

I was making a silly mistake by adding an unnecessary line, which kept overriding, and due to that, the error was not solved. So just remove the below line

;extension=apcu.so


;;;;;;;;;;;;;;;;;;;
; Nextcloud Config

extension=apcu.so
apc.enable_cli = 1

and made it into this and it worked.


;;;;;;;;;;;;;;;;;;;
; Nextcloud Config

apc.enable_cli = 1

This error made me go crazy for an entire month😂.

Thanks a lot, sir.