I cannot for the life of me get Redis to work (RESOLVED)

Try to be concrete in your question! What doesn’t work, what are you trying to do and on what platform (distribution, versions etc), tools etcetera?



This is on Ubuntu Server 16.04
php7
nextcloud 11 (upgraded as of today)
Everything after the upgrade runs fine
I do have https enabled and redirected
I do have the strict ssl enabled
I have never gotten memcache to work before







I am trying to setup memcche with redis. I have installed Redis, made it was running and set it start on boot. Everything works at this point.

However when I alter the config.php with the memcache stuff, this is when the nextcloud server literally goes white. Reboot … restart redis … nothing helps until I remove the entries from the config.php and then my site works again.

This is the site I am referencing… I have tried many many others … https://bayton.org/2016/07/installing-nextcloud-on-ubuntu-16-04-lts-with-redis-apcu-apache/

In that guide it said to change the port for redis to 0 in the redis config. so I did.
I also uncommented two lines and changed the permission on one … as below:

unixsocket /var/run/redis/redis.sock
unixsocketperm 700 changing permissions to 770 at the same time: unixsocketperm 770

I then ran this:

sudo usermod -a -G redis www-data

then I edited the config.php file and added this to the very bottom of the file right before the );

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

so now my entire config.php looks like this:

<?php $CONFIG = array ( 'instanceid' => 'xxxxx', 'passwordsalt' => '+xxxxx', 'secret' => 'xxxxx+', 'trusted_domains' => array ( 0 => 'site.com', ), 'datadirectory' => '/var/www/nextcloud/data', 'overwrite.cli.url' => 'http://localhost', 'dbtype' => 'mysql', 'version' => '11.0.0.10', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => 'user', 'dbpassword' => 'xxxxxx', 'logtimezone' => 'UTC', 'installed' => true, 'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => 'ssl', 'maintenance' => false, 'loglevel' => 2 'memcache.local' => '\OC\Memcache\APCu', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'filelocking.enabled' => 'true', 'redis' => array ( 'host' => '/var/run/redis/redis.sock', 'port' => 0, 'timeout' => 0.0, ), ); is something wrong with the placement of the ), or the );? or ANYTHING else that anyone can think of?? I have absolutely NO idea what to do at this point. I have tried to many guides and just different things on my own and nothing has worked. any help would really really be appreciated as this is driving me nuts.

It looks good to me.

  • Is the redis-server running? sudo service status redis-server
  • Have you installed all prerequisite packages referenced in the guide?
  • Have you inspected your Apache logs for errors?
  • Have you checked your Nextcloud log? /var/www/nextcloud/data/nextcloud.log

One of those should hopefully identify the issue.

Also check if /var/run/redis/redis.sock is actually created after redis-server start to further delimit the problem.

€: Ah and of course redis log /var/log/redis/redis-server.log if enabled.

1 Like

interesting thing is that when I run
sudo service status redis-server
it does come back and says: unrecognized service

but when I run ps ax | grep redis I do get this:
root@ubuntu:/var/www/nextcloud/data# ps ax | grep redis
1255 ? Ssl 0:37 /usr/bin/redis-server 127.0.0.1:0
14250 pts/0 S+ 0:00 grep --color=auto redis

then in the apache2 error.log it says

[Tue Dec 20 06:25:04.436480 2016] [mpm_prefork:notice] [pid 1391] AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g configured – resuming normal operations
[Tue Dec 20 06:25:04.436674 2016] [core:notice] [pid 1391] AH00094: Command line: ‘/usr/sbin/apache2’
[Tue Dec 20 13:44:22.684623 2016] [:error] [pid 11467] [client 24.137.136.155:62209] PHP Parse error: syntax error, unexpected ‘‘memcache.local’’ (T_CONSTANT_ENCAPSED_STRING), expecting ‘)’ in /var/www/nextcloud/config/config.p$
[Tue Dec 20 13:44:47.777790 2016] [:error] [pid 13603] [client 24.137.136.155:62212] PHP Fatal error: Uncaught Error: Call to a member function getLogger() on null in /var/www/nextcloud/index.php:61\nStack trace:\n#0 {main}\n $

I didnt see much in the nextcloud.log.
then again there is sooo much in there and im not sure what would pertain to this issue.

I did find the redis.sock

for whatever reason I could not find any redis.log anywhere

Well gosh I read over your config twice before I commented, but you are in fact missing a comma after 'loglevel' => 2

Fix that and the problem should resolve. Apache log pointed it out as follows:

Where it should only expect the closing bracket at the end of the file.

ok I`ll try that.

but unfortunately I believe that I messed up the server pretty bad trying to get this to work. I installed two things and after it no longer works … so I think I am gonna have to set it all up again and then move the data back to it.
I did two things … looking at some guides.

I ran this
sudo apt install php-zip php-dompdf php-xml php-mbstring php-gd php-curl

and then I ran
apt-get install php7.0-dev -y

I am not sure which one did it …annnd not tooooo sure what to do to undo it. maybe a purge php7.0-dev and the other not too sure.

if you have any ideas I would appreciate it … if not looks like ill just have to install it all over again and set it up.

This is fine, you’re just installing optional modules that may or may not be used.

This probably broke it as you’re installing a development branch of PHP7. Purge that and go from there.

thanks for the reply

I did use apt-get remove php.7.0-dev and it said that it removed it.

then i ran sudo apt-get purge --auto-remove php7.0-dev and it removed more … restarted apache2 and the server … removed the memcache info from config and when I go to the site its still a white screen …ugh.

EDIT

ok so I got a little closer

I got it to load … sort of

I get this now

PHP module zip not installed.

Please ask your server administrator to install the module.
PHP module mb multibyte not installed.

Please ask your server administrator to install the module.
PHP module cURL not installed.

Please ask your server administrator to install the module.
PHP modules have been installed, but they are still listed as missing?

Please ask your server administrator to restart the web server.

Is PHP still installed in any means on the server?

sudo apt-get install php

ok so I just ran

apt-get install php-bz2 php-curl php-gd php-imagick php-intl php-mbstring php-xml php-zip

that seems like it got it work again …

holy hell that was a little scary

now I am going to try and mess with the config file with the memcache again.

Even Jasons eagle eyes already found the problem:

  • To find the redis log file see “logfile” parameter in your redis.conf or the parameters around, in case log is configured to syslog or somehow disabled.

  • To check the redis status the command is “sudo service redis-server status” , so “status” after the service name ;).

ok so after I resurrected it I edited the config.php

I added

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

so now my config.php file looke like this

<?php $CONFIG = array ( 'instanceid' => 'redacted', 'passwordsalt' => '+redacted', 'secret' => 'redacted', 'trusted_domains' => array ( 0 => 'site.com', ), 'datadirectory' => '/var/www/nextcloud/data', 'overwrite.cli.url' => 'http://localhost', 'dbtype' => 'mysql', 'version' => '11.0.0.10', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'dbuser' => 'nextcloud', 'dbpassword' => 'password', 'logtimezone' => 'UTC', 'installed' => true, 'mail_smtpmode' => 'smtp', 'mail_smtpsecure' => 'ssl', 'maintenance' => false, 'loglevel' => 2, 'memcache.local' => '\OC\Memcache\APCu', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'filelocking.enabled' => 'true', 'redis' => array ( 'host' => '/var/run/redis/redis.sock', 'port' => 0, 'timeout' => 0.0, ), );

Now everything works with memcache and all check have passed in the admin page. I`m not screwing with anything from now on lol.

Thank you for all the help! I cannot tell you how long I have been trying to do this and how many virtual test machines I have created and destroyed over this lol … even though I was using my live nextcloud server this time.

1 Like

Thanks for the reply … seems like I got everything working. It was missing an , in the config.php.