Redis for PHP Sessions on Ubuntu Server

Redis Installation

Add repo which maintains latest redis

add-apt-repository ppa:chris-lea/redis-server

Install redis-server and php-binding

apt-get install redis-server php5-redis

PHP session config

Open file vim /etc/php5/mods-available/redis.ini

Add following lines:

session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379"

Restart PHP5-FPM

service php5-fpm restart

Web Viewer

Paths we are referring are EasyEngine specific:

mkdir /var/www/22222/htdocs/cache/redis && cd /var/www/22222/htdocs/cache/redis

phpRedisAdmin

Link: https://github.com/ErikDubbelboer/phpRedisAdmin

git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
cd phpRedisAdmin
git clone https://github.com/nrk/predis.git vendor

redis-inspector

git clone https://github.com/tijmenb/redis-inspector

Restart CLI commands

redis-cli gets automatically installed.

monitor

redis-cli monitor

List all keys

redis-cli KEYS *

Leave a Reply