'Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away'

One of my application suddenly started to give error:

Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away' in /var/www/_slim/_core/system/generator.001.php:133 Stack trace: #0 /var/www/_slim/_core/system/generator.001.php(133): Redis->auth('77B1BFFBC0378DF...') #1 /var/www/_slim/_core/system/generator.007.php(144): Generator001->r6_redis_start('R') #2 /var/www/_slim/_core/system/generator.007.php(26): Generator007->HarvestRedis() #3 /var/www/_slim/_core/system/generator.shopping.php(14): Generator007->Generator007() #4 /var/www/_slim/_core/system/generator.last.php(43): Generator008->Generator008() #5 /var/www/_slim/site/home/php/index.php(16): GeneratorLast->GeneratorLast() #6 /var/www/index.php(96): Gui->Gui()
#7 {main} thrown in /var/www/_slim/_core/system/generator.001.php on line 133

I have reinstalled redis-server but no luck so far. Any suggestions?



Solution 1:[1]

Maybe not the answer to the specific question, but might help those new to Redis who come here by googling the Exception.

You will also get this exception if you create a Redis instance and start to call methods on it without first connecting to a Redis server by calling

$redis->connect('localhost')

The arguments for the call should obviously be adjusted if Redis is not a local host, configured to listen on a different port, set up a password etc.

Solution 2:[2]

I had a problem connecting to the redis

I managed to solve it by changing the colon to a comma

$redis->connect('localhost:6379');

from this to this

$redis->connect('localhost', 6379);

Solution 3:[3]

If you are running on a local/dev environment, make sure that Redis Service is running.

You can check if your local service is running by opening the Redis Client cmd. If you are on a MAC open the command line and type redis-cli.

If your server is running you should see:

redis 127.0.0.1:6379>

In my case I forgot to start the windows service so all I had to do was to: open services.msc, start Redis Server service.

Solution 4:[4]

I've had the same issue when integrating my software with local Redis installation. Turned out "localhost" host name was not resolved (stuff was was running in a docker container which didn't know that). Changed it to regular loopback IP "127.0.0.1" in the client config and it rolls.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Okneloper
Solution 2 ????????? ?????
Solution 3 Bartho Bernsmann
Solution 4 Krzysztof Jab?o?ski