0

Its my fifth day trying to fix this on my mac mountain-lion. I used home brew to install phpredis using this http://www.astonishdesign.com/blog/native-lamp-stack-mac-os-x. By the way home brew was also used to install redis. My php info shows

redis
Redis Support   enabled
Redis Version   2.2.3

when I run this code

$redis = new Redis();
$redis->connect('127.0.0.1', 6379);

$redis->set('key', 'val');

echo $redis->get('key')

;

I get this error

 Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away' in /Library/WebServer/Documents/test/index.php on line 6
    ( ! ) RedisException: Redis server went away in /Library/WebServer/Documents/test/index.php on line 6

What am I missing

Asim Zaidi
  • 27,016
  • 49
  • 132
  • 221

1 Answers1

1

Are you sure the Redis Server is running?

If you go to the Mac command line and type redis-cli, do you get a prompt like:

redis 127.0.0.1:6379>

If not, your server isn't running. You can start it manually by running redis-server, then test your script.

There are probably better ways of running redis server on a mac, but at least you'll know if it's just a matter of starting the server.

teleclimber
  • 318
  • 3
  • 7