Cannot setup and configure Redis for Memory Caching | Internal Server Error

Nextcloud version (18.0.1):
Operating system and version (Ubuntu 16.04.6 LTS):
Apache or nginx version (Apache 2.4.18):
PHP version (7.3):

The issue you are facing:

I setup a new instance of next cloud and started following the security and setup suggestion on the Admin>Overview page.

One of the reccomendations was: No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the documentation.

So I read the docs and then found this guide: https://www.techrepublic.com/article/how-to-enable-caching-on-nextcloud-16/

I reached the last step of editing the config.php and encountered this error when refreshing the page: Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Originally I discovered that the /var/run/redis/redis.sock file was missing but I used the steps found here to resolve that problem: [PHP] Error: Redis::connect(): connect() failed: No such file or directory at /var/www/nextcloud/lib/private/RedisFactory.php#90

The file now exists but I still get the internal server error when browsing to the page.

If I remove the following from the config.php it works again:

'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '/var/run/redis/redis.sock',
'port' => 0,
'timeout' => 0,
'password' => '',
'dbindex' => 0,
)

I have been through numourous community articles here and elsewhere trying to resolve it to no avail.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Fresh Install of NExtcloud
  2. install Redis using this link: https://www.techrepublic.com/article/how-to-enable-caching-on-nextcloud-16/
  3. Upon last step in changing config.php I receive internal server error

The output of your Nextcloud log in Admin > Logging: I only included the last line as there are 14k lines in the log. Which may point to a bigger problem, haha.

{"reqId":"nP8JoQMDb7coMb4bok8W","level":3,"time":"2020-03-02T21:37:16+00:00","remoteAddr":"68.116.21.26","user":"--","app":"core","method":"GET","url":"/index.php/csrftoken","message":{"Exception":"RedisException","Message":"Redis server went away","Code":0,"Trace":[{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Memcache/Redis.php","line":54,"function":"get","class":"Redis","type":"->","args":["6f7f7b7601f8051fdb768a647ff21d91/core.appinfo/home/domainuser/domains/cloud.domain.com/public_html/apps/accessibility/appinfo/info.xml1583110254"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/App/InfoParser.php","line":58,"function":"get","class":"OC\\Memcache\\Redis","type":"->","args":["/home/domainuser/domains/cloud.domain.com/public_html/apps/accessibility/appinfo/info.xml1583110254"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/App/AppManager.php","line":511,"function":"parse","class":"OC\\App\\InfoParser","type":"->","args":["/home/domainuser/domains/cloud.domain.com/public_html/apps/accessibility/appinfo/info.xml"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/legacy/app.php","line":558,"function":"getAppInfo","class":"OC\\App\\AppManager","type":"->","args":["accessibility",false,null]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/AppFramework/App.php","line":67,"function":"getAppInfo","class":"OC_App","type":"::","args":["accessibility"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/legacy/app.php","line":241,"function":"buildAppNamespace","class":"OC\\AppFramework\\App","type":"::","args":["accessibility"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/legacy/app.php","line":120,"function":"registerAutoloading","class":"OC_App","type":"::","args":["accessibility","/home/domainuser/domains/cloud.domain.com/public_html/apps/accessibility"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/legacy/util.php","line":197,"function":"loadApps","class":"OC_App","type":"::","args":[["filesystem"]]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Files/Filesystem.php","line":267,"function":"setupFS","class":"OC_Util","type":"::","args":[""]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Server.php","line":319,"function":"getMountManager","class":"OC\\Files\\Filesystem","type":"::","args":[null]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/3rdparty/pimple/pimple/src/Pimple/Container.php","line":118,"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\Container","type":"->","args":["RootFolder"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Server.php","line":341,"function":"query","class":"OC\\ServerContainer","type":"->","args":["RootFolder"]},{"function":"OC\\{closure}","class":"OC\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Files/Node/LazyRoot.php","line":62,"function":"call_user_func","args":[{"__class__":"Closure"}]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Files/Node/LazyRoot.php","line":142,"function":"__call","class":"OC\\Files\\Node\\LazyRoot","type":"->","args":["get",["appdata_oc9h7z2hiyaj/js/core"]]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Files/AppData/AppData.php","line":143,"function":"get","class":"OC\\Files\\Node\\LazyRoot","type":"->","args":["appdata_oc9h7z2hiyaj/js/core"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Template/JSCombiner.php","line":96,"function":"getFolder","class":"OC\\Files\\AppData\\AppData","type":"->","args":["core"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Template/JSResourceLocator.php","line":115,"function":"process","class":"OC\\Template\\JSCombiner","type":"->","args":["/home/domainuser/domains/cloud.domain.com/public_html","core/js/merged-template-prepend.json","core"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Template/JSResourceLocator.php","line":71,"function":"cacheAndAppendCombineJsonIfExist","class":"OC\\Template\\JSResourceLocator","type":"->","args":["/home/domainuser/domains/cloud.domain.com/public_html","core/js/merged-template-prepend.json"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Template/ResourceLocator.php","line":78,"function":"doFind","class":"OC\\Template\\JSResourceLocator","type":"->","args":["js/merged-template-prepend"]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/TemplateLayout.php","line":346,"function":"find","class":"OC\\Template\\ResourceLocator","type":"->","args":[["core/js/dist/main","js/merged-template-prepend","search/js/search","core/l10n/en","search/l10n/en","search/js/searchprovider","js/files/fileinfo","js/files/client"]]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/TemplateLayout.php","line":174,"function":"findJavascriptFiles","class":"OC\\TemplateLayout","type":"::","args":[["core/js/dist/main","js/merged-template-prepend","search/js/search","core/l10n/en","search/l10n/en","search/js/searchprovider","js/files/fileinfo","js/files/client"]]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/legacy/template.php","line":184,"function":"__construct","class":"OC\\TemplateLayout","type":"->","args":["error",""]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Template/Base.php","line":132,"function":"fetchPage","class":"OC_Template","type":"->","args":[]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/legacy/template.php","line":333,"function":"printPage","class":"OC\\Template\\Base","type":"->","args":[]},{"file":"/home/domainuser/domains/cloud.domain.com/public_html/index.php","line":65,"function":"printExceptionErrorPage","class":"OC_Template","type":"::","args":[{"__class__":"RedisException"},500]}],"File":"/home/domainuser/domains/cloud.domain.com/public_html/lib/private/Memcache/Redis.php","Line":54,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0","version":"18.0.1.3"}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '******',
  'passwordsalt' => '********',
  'secret' => '*********',
  'trusted_domains' => 
  array (
    0 => 'cloud.domain.com',
  ),
  'datadirectory' => '/home/domainuser/domains/cloud.domain.com/public_html/data',
  'dbtype' => 'mysql',
  'version' => '18.0.1.3',
  'overwrite.cli.url' => 'http://cloud.domain.com',
  'dbname' => 'cloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'dbuser',
  'dbpassword' => '******',
  'installed' => true,
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'domain.com',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'domain.com',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'cloud@domain.com',
  'mail_smtppassword' => '*********',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
   array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0,
    'password' => '',
    'dbindex' => 0,
)
);

The output of your Apache/nginx/system log in /var/log/____:

[Mon Mar 02 06:25:23.324201 2020] [suexec:notice] [pid 110602] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 06:25:23.519720 2020] [mpm_prefork:notice] [pid 110603] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 06:25:23.519766 2020] [core:notice] [pid 110603] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 06:25:28.154536 2020] [mpm_prefork:notice] [pid 110603] AH00171: Graceful restart requested, doing restart
[Mon Mar 02 06:25:31.381257 2020] [mpm_prefork:notice] [pid 110603] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 06:25:31.381314 2020] [core:notice] [pid 110603] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 10:13:55.705356 2020] [mpm_prefork:notice] [pid 110603] AH00171: Graceful restart requested, doing restart
[Mon Mar 02 10:13:59.923713 2020] [mpm_prefork:notice] [pid 110603] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 10:13:59.923758 2020] [core:notice] [pid 110603] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 10:17:07.664228 2020] [mpm_prefork:notice] [pid 110603] AH00171: Graceful restart requested, doing restart
[Mon Mar 02 10:17:10.977945 2020] [mpm_prefork:notice] [pid 110603] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 10:17:10.977972 2020] [core:notice] [pid 110603] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 10:18:18.896016 2020] [mpm_prefork:notice] [pid 110603] AH00171: Graceful restart requested, doing restart
[Mon Mar 02 10:18:22.136508 2020] [mpm_prefork:notice] [pid 110603] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 10:18:22.136556 2020] [core:notice] [pid 110603] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 10:33:23.620814 2020] [mpm_prefork:notice] [pid 110603] AH00169: caught SIGTERM, shutting down
[Mon Mar 02 10:33:24.757081 2020] [suexec:notice] [pid 71754] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 10:33:25.124784 2020] [mpm_prefork:notice] [pid 71755] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 10:33:25.124832 2020] [core:notice] [pid 71755] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 10:44:25.558942 2020] [mpm_prefork:notice] [pid 71755] AH00169: caught SIGTERM, shutting down
[Mon Mar 02 10:44:26.585359 2020] [suexec:notice] [pid 75558] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 10:44:26.753357 2020] [mpm_prefork:notice] [pid 75559] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 10:44:26.753403 2020] [core:notice] [pid 75559] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 11:24:46.457373 2020] [mpm_prefork:notice] [pid 75559] AH00169: caught SIGTERM, shutting down
[Mon Mar 02 11:24:47.589753 2020] [suexec:notice] [pid 90352] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 11:24:47.725729 2020] [mpm_prefork:notice] [pid 90353] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 11:24:47.725782 2020] [core:notice] [pid 90353] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 11:54:35.652537 2020] [mpm_prefork:notice] [pid 90353] AH00169: caught SIGTERM, shutting down
[Mon Mar 02 11:54:36.783079 2020] [suexec:notice] [pid 103443] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 11:54:36.952519 2020] [mpm_prefork:notice] [pid 103446] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 11:54:36.952569 2020] [core:notice] [pid 103446] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 11:58:27.957917 2020] [mpm_prefork:notice] [pid 103446] AH00169: caught SIGTERM, shutting down
[Mon Mar 02 11:58:28.929257 2020] [suexec:notice] [pid 105184] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 11:58:29.116272 2020] [mpm_prefork:notice] [pid 105185] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 11:58:29.116393 2020] [core:notice] [pid 105185] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 12:14:06.098297 2020] [mpm_prefork:notice] [pid 105185] AH00169: caught SIGTERM, shutting down
[Mon Mar 02 12:14:07.181987 2020] [suexec:notice] [pid 111791] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 12:14:07.337348 2020] [mpm_prefork:notice] [pid 111792] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 12:14:07.337396 2020] [core:notice] [pid 111792] AH00094: Command line: '/usr/sbin/apache2'
[Mon Mar 02 13:19:45.043300 2020] [mpm_prefork:notice] [pid 111792] AH00169: caught SIGTERM, shutting down
[Mon Mar 02 13:19:46.082716 2020] [suexec:notice] [pid 15056] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Mon Mar 02 13:19:46.254940 2020] [mpm_prefork:notice] [pid 15061] AH00163: Apache/2.4.18 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Mar 02 13:19:46.254982 2020] [core:notice] [pid 15061] AH00094: Command line: '/usr/sbin/apache2'

Sorry if this is overkill on the info. Please let mw know what other info I can provide to help find a resolution.

Found my issue.

I missed the critical step of installing php-memcache

I feel dumb but maybe this will help someone else.

I followed that same guide and had the same problem. You say you missed the critical step of installing php-memcache. I took another look at the guide and php-memcache isn’t mentioned. How exactly did you solve the issue?

you saw this: [SOLVED] Latest Docker image broke the installation (Redis password auth) ?

the how-to you followed seems a bit out-dated since it is about nc16. so if redis6 is now default in your distro and doesn’t work without password anymore you might be affected.

i don’t think you need that. php-redis should be installed. or?

Just solved it by changing ‘memcache.local’ => ‘\OC\Memcache\Redis’, to ‘memcache.local’ => ‘\OC\Memcache\APCu’,

1 Like