hkguile
hkguile

Reputation: 4369

enable redis on xampp in windows

I'm trying to make redis work on xampp, my xampp is 32bit on windows 10, php version is 5.6, i download redis here

http://pecl.php.net/package/redis/2.2.7/windows (the x86 thread safe one), and added

extension=php_redis.dll in php.ini, the redis server i installed on virtualbox with linux (the selinux is disabled)

here is the script i run on 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");

?>

the error shows:

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

anyone know what is the problem? Am i install the extension correctly?

Upvotes: 2

Views: 12689

Answers (1)

Roberto Gon&#231;alves
Roberto Gon&#231;alves

Reputation: 3434

You need to make sure if your redis-server is listening on port 6379 like:

redis-cli -h 192.168.0.108

It must respond with:

192.168.0.108:6379>

After you make sure that is the answer, your connection will be successful.

Related question:

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

Upvotes: 1

Related Questions