我正在尝试使redis在xampp上工作,我的xampp在windows10上是32位,php版本是5.6,我在这里下载redis。
http://pecl.php.net/package/redis/2.2.7/windows ( x86线程安全),并添加了
php.ini中的extension=php_redis.dll,我在带有linux的virtualbox上安装的redis服务器( selinux被禁用)
下面是我在windows上运行的脚本
<?php
//Connecting to Redis server on localhost
$redis = new Redis();
$redis->connect('192.168.0.108', 6379);
echo "Connection to server sucessfully";
var_dump($redis);
$redis->set("say","Hello World");
echo $redis->get("say");
?>该错误显示:
Connection to server sucessfullyobject(Redis)#1 (0) { }
Fatal error: Uncaught exception 'RedisException' with message
'Redis server went away' in
D:\xampp\htdocs\test\redis\test.php:8 Stack trace: #0
D:\xampp\htdocs\test\redis\test.php(8): Redis->set('say', 'Hello World') #1 {main} thrown in
D:\xampp\htdocs\test\redis\test.php on line 8有人知道问题出在哪里吗?我是否正确安装了扩展?
发布于 2017-08-05 01:44:54
您需要确保redis-server是否正在侦听端口6379,如下所示:
redis-cli -h 192.168.0.108它必须以以下方式响应:
192.168.0.108:6379>在您确定这是答案之后,您的连接将会成功。
相关问题:
Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away'
https://stackoverflow.com/questions/45504474
复制相似问题