Internal Server error after installing redis and apcu

we are facing internal server error if we tries uploading any files. after installing and config of redis and apcu in our centos 7 with nextcloud.

first what i found on apache log file after i restart httpd service
zend_mm_heap corrupted

then i also found error on nextcloud log
Error PHP Redis::connect(): connect() failed: No such file or directory at /var/www/html/nextcloud/lib/private/RedisFactory.php#82

under config.php
here is what i paste

‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => true,
‘redis’ =>
array (
‘host’ => ‘/tmp/redis.sock’,
‘port’ => 0,
‘timeout’ => 0.0,
),

On Centos 7, I’ve this config:

/etc/redis.conf file:

port 0
unixsocket /var/run/redis/redis.sock
unixsocketperm 775

and in the nextcloud config file:

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

Also the next command should return a PONG:

reds-cli -s /var/run/redis/redis.sock ping

Maybe this will help you.

3 Likes

This is not necessary for single server systems.

Nice idea to test the redis server directly first. In @rsumook case would be:

redis-cli -s /tmp/redis.sock ping

Having a look into the code, it seems that your webserver can’t reach the socket file: https://github.com/nextcloud/server/blob/master/lib/private/RedisFactory.php#L82 (by the way you see there, that timeout = 0.0 is set by default, thus could be left out :wink:)

The reason could be, that web server is somehow limited in having a look into the /tmp folder on certain systems. I got e.g. a problem when setting the tmp php upload folder to /var/tmp/php_upload_tmp: Missing upload-tmp or not writable

So I would really follow the default socket location:

nano /etc/redis.conf
   unixsocket /var/run/redis/redis.sock
service redis-server restart
nano /var/www/html/nextcloud/config/config.php
   'host' => '/var/run/redis/redis.sock',
service apache2 restart

its weird yesterday i removed this code to make our nc working again because all users cant upload files with internal server error.

errorredis

under redis.conf

i modified unixsocket to /tmp/redis.sock because i run whereis redis.socket in the terminal and unixsocketperm from 770 to 775
unixsocket

then i restarted the httpd and redis service

but i got error on page

[root@stp1200 config]# redis-cli -s /var/run/redis/redis.sock ping
PONG
[root@stp1200 config]#

you are correct Michalng i follow the default socket location then its working fine

edit the redis.conf
workingunixsocket

then i added memcache diributed actually even without this my nc still working
working configredis

no more warning errors for memcache except https

thank you very very much :wink: