当前位置:Gxlcms >
PHP教程 >
phpredisUncaughtexception'RedisException'withmessage'Redisserverwenta解决方案
phpredisUncaughtexception'RedisException'withmessage'Redisserverwenta解决方案
时间:2021-07-01 10:21:17
帮助过:13人阅读
php redis Uncaught exception 'RedisException' with message 'Redis server went a
php代码:
ini_set('default_socket_timeout', -1);
$redis = new Redis();
$redis->connect("192.168.2.156","6379"); //php客户端设置的ip及端口
$redis->auth('123456');
//$redis->select(1);
$redis->set("say","Hello World");
$data = $redis->get("say"); //应输出Hello World
var_dump($data);
提示错误:Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away' in /usr/local/nginx/html/index.php:56 Stack trace: #0 /usr/local/nginx/html/index.php(56): Redis->auth('123456') #1 {main} thrown in /usr/local/nginx/html/index.php on line 56
redis服务打开了,防火墙也给关闭了,phpinfo里也看到了php的redis扩展,selinux不管设置成disabled还是permissive都不好用,真不知道是哪里出问题了,请高手指点
------解决思路----------------------
商刻的未来就看你了