Tag Archives: nextcloud

How To Fix Memcache \OC\Memcache\APCu not available for local cache – Nextcloud

Today I updated my self install of Nextcloud from version 22.2.3 to 23.0.0 and after the update I visited the status (Settings->Overview) page in order to see if there are any pending issues and saw the following warning:

    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 "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.
        Missing index "fs_id_storage_size" in table "oc_filecache".
        Missing index "fs_storage_path_prefix" in table "oc_filecache".

Please double check the installation guides, and check for any errors or warnings in the log.

Check the security of your Nextcloud over our security scan

The error indicates that I can simply run “occ db:add-missing-indices” at the command line and the error should be resolved so I navigated to the occ directory and issued the command “sudo -u www-data php occ db:add-missing-indices” but received another error instead:

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

Some research led to this github issue which suggested adding apc.enable_cli = 1 to the file apcu.ini located in /etc/php/7.4/mods-available (please note that your version of php may be different) which turns out, it solved the issue allowing me to successfully run sudo -u www-data php occ db:add-missing-indices again.

I now have a clean status page!

Nextcloud status page