Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Redis Error: Uncaught exception ‘RedisException’

Tags:

php

redis

I use Redis to build a IOS SNS App (for restful api). As more user use it, errors happened.

It throws out :

Uncaught exception 'RedisException' with message 'read error on connection' 
in /data1/www/htdocs/11/iossns/Model/Core/Redis.php

I don't know how to solve the problem.

Can you help?

Thank you!

like image 945
taogogo Avatar asked Apr 10 '12 06:04

taogogo


1 Answers

What PHP-to-Redis library are you using? Here’s the official list from Redis. What is your webserver? (Apache, nginx, etc) How is PHP running? (CGI, FPM, mod_php, etc)

Here’s a thread for the same exception message in phpredis. It turns out phpredis does not currently support persistent connections with php-fpm. Version 2.2.3 of phpredis has some connection handling changes that might decrease the frequency of your issues.

I recommend checking your Redis connector configuration to…

  1. disable persistent connections
  2. enable connection retries
  3. increase log verbosity

You might also consider adjustments to (generally increasing) default_socket_timeout in php.ini.

like image 160
parhamr Avatar answered Oct 04 '22 02:10

parhamr