Hosting: Enabling Redis class on MediaTemple’s gridserver (gs)

Here's how I enabled access to a Redis server from my (GS) gridserver:

1. Store your SITEID in a variable:

export SITEID=`pwd | awk -F\/ '{ print $3 }'`

 

2. Create a folder to store the redis.so module

mkdir /home/$SITEID/data/lib
mkdir /home/$SITEID/data/lib/php/

 

3. Get the Redis PECL package (2.2.4 is the latest as of now)

wget http://pecl.php.net/get/redis-2.2.4.tgz

 

4. Uncompress it

tar -xvzf redis-2.2.4.tgz
cd redis-2.2.4

 

5. Compile it. I've set my (gs) to use PHP 5.5.5; change your accordingly

./configure --with-php-config=/usr/local/php-5.5.5/bin/php-config
make

 

6. "install" the module

cp modules/*.so /home/$SITEID/data/lib/php

 

7. Add the following to your /home/SITEID/etc/php.ini

;PECL
extension_dir=/home/97042/data/lib/php/
;redisphp
extension=redis.so

 

Check it:

Visit http://SITEID.gridserver.com/gs-bin/phpinfo.php-latest

 

redis-2-2-4-module

References

  • https://kb.mediatemple.net/questions/1682/Installing+PECL+extensions#gs
  • https://github.com/nicolasff/phpredis/issues/42
  • http://pecl.php.net/package/redis
Tagged , , , , , , . Bookmark the permalink.

Leave a Reply