Message: The database is used for transactional file locking and no in-memory cache has been configured

Good afternoon,

I have a virtual server with Linux Debian 11 installed.

image

In it I have NextCloud 27.0.0 with PHP 8.2.7

image

I installed and configured all PHP modules following the official NextCloud documentation, but my problem persists and the two alert messages persist:

1 - The database is used for transactional file locking. To improve performance, configure memcache if available.

2 - No memory cache has been configured. To improve performance, set up a memcache, if available.

This is the configuration file for /var/www/html/nextcloud/config/config.php

As you can see I made several attempts, all without success. I want to record that I left the attempts just so that you can check and help me, all are now commented, because when one of them is activated, the nextCloud web page presents the error below:

I always restart the apache2 service when I make changes to the /var/www/html/nextcloud/config/config.php file

Can anyone help me with any tips that really work, because I’ve researched a lot and so far nothing has solved this.

Is your Redis server runing? You did not mention that. Is it configured

You should look in the logfiles (and provide them here if you do not find the solution with that info), not the message about internal server error which provides no information

View your logfile:

sudo tail -F /var/www/html/nextcloud/data/nextcloud.log | jq

(eventually install jq if missing: sudo apt install jq)

If you do not find your logfile (per default in data directory) you can view your log with occ:

sudo -u www-data php -f /var/www/html/nextcloud/occ log:tail -f

Did you read all the tips from here: Memory caching — Nextcloud latest Administration Manual latest documentation

It wil not work as long as redis-server is not runing and not configured so that it can speak with nextcloud.

Good morning,

Yes, the redis service is active on startup and running.

According to the documentation, I only made two changes to the /etc/redis/redis.conf file

image

My file is configured like this:

image

I will now check your suggestions about /var/www/html/nextcloud/data/nextcloud.log
It is
sudo -u www-data php -f /var/www/html/nextcloud/occ log:tail -f

I’ll be right back with the return.

You have set the port to 0 in /etc/redis/redis.conf which means it is not listening on a TCP socket, but on a UNIX socket instead. In order to make Nextcloud connect to the UNIX socket you have to change the following line in your config.php, from…

'host' => 'localhost',

…to:

'host' => '/var/run/redis/redis-server.sock',

Here’s the relevant part from my config.php:

 'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'dbindex' => 0,
    'timeout' => 1.5,
  ),

Since Nextcloud is run by user www-data and redis by user redis, you have to set permissions to 777:

unixsocketperm 777

(or add www-data to group redis, but the above solution is easier)

This is how I have it in config.php:

  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => true,
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0,
  ),

You can monitor live, what redis does with

sudo -u redis redis-cli -s /var/run/redis/redis-server.sock monitor

Much luck!

Guys,

I identified the error, it was just a comma on line 23 of the /var/www/html/nextcloud/config/config.php file.

I had posted an image above, which I will paste here again below, for the record, I made the correction and the problem was successfully corrected.

Sorry for my mistake and lack of attention.
Thanks to everyone who tried to help. Thanks.

2 Likes

Your suggestions helped identify the problem, thank you very much.

2 Likes

Follow your suggestion and change the line ‘host’ => ‘/var/run/redis/redis-server.sock’, your suggestions helped to identify the problem, thank you very much.

2 Likes

Yup, I missed that one, the www-data user has to be in the redis group for it to work with 770 permissions

It’s one simple command…

usermod -aG redis www-data

…and it’s the more elegant and secure solution. Setting things to 777 is hardly ever a good solution. Additionally, you could also set a password, but let’s leave that out for now… :wink:

2 Likes

:+1: Glad it worked out.