PHP and Redis

I’m on an old Ubuntu version, and just needed something to dump a Redis value as JSON.
sudo -s
git clone https://github.com/nicolasff/phpredis
cd phpredis
aptitude install php5-dev -y
phpize
./configure && make && make test && make install
echo "extension=redis.so" > /etc/php5/conf.d/20-redis.ini
service apache2 restart

And then
<?php
#
# Serves the JSON clob from Redis
#
header('Content-Type: application/json');
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);
$data = $redis->get('movie_database');
echo $data;
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>