Can't add missing indexes to database with occ command

Hello All,

I have the typical error in security and setup warnings as below:

  • 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 optional index “mail_messages_strucanalyz_idx” in table “mail_messages”. Missing optional index “mail_class_creat_idx” in table “mail_classifiers”. Missing optional index “mail_acc_prov_idx” in table “mail_accounts”. Missing optional index “mail_alias_accid_idx” in table “mail_aliases”.

I had started by moving to my nextcloud web server dir, /var/www/nextcloud and then doing sudo -u www-root php occ db:add-missing-indices but I get:

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

I then checked to make sure I had the ‘memcache.local’ => ‘\OC\Memcache\APCu’, in my config.php for nextcloud which I do, then I made sure I had apcu installed and enable with:

sudo apt-get update
sudo apt-get install php-apcu

adding to php.ini (Running 8.2)

And then rebooting the server and trying the command again but I get the same error. I’m not sure If I’ve got something wrong. The only other error I have in the security and setup warnings is this:

The database is used for transactional file locking. To enhance performance, please configure memcache, if available. For more details see the documentation :arrow_upper_right:

Any help would be appreciated.


Happy Nextcloud User

you can try changing the module-parameters.
Mine (Debian11; php 8.2) look like this
in /etc/php/8.2/mods-available/apcu.ini

the enable.cli is the important one.