redis throws an error even though extension is loaded just fine

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

Answers


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.


Need Your Help

How to get JPEG module working in PIL

python compression jpeg python-imaging-library

I installed PIL and all the jpeg dependencies for using the jpeg module in PIL

How to make an NSMenu recent list

cocoa nsmenu nsstatusitem

I'm working on a small URL shortening application for someone, and I need to have a list, similar to that of Droplr's, that has all of the recently shortened URLs. The list should be a submenu of the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.