This small script implements a quick and dirty Redis backend for your php session.
Essentially, it does nothing more than https://github.com/ivanstojic/redis-session-php, just something less, because for the sake of easiness we store only the base64 encoded session string.
So why to implement this backend? In redis-session-php, ivanstojic used Predis as the client library for handling the connection to Redis and that impose to have php version 5.3 or higher. Rediska seems to have more relaxed requirements for php version and so that’s the story!
Install Rediska and set the correct include in redis_session.php
then you just have to require(_once)
this file at the very beginning of your pages, then call session_start()
when you need.
<?php require_once('redis_session.php'); // ... session_start(); $_SESSION['test'] = 1; ...
Released under the terms of the GNU GENERAL PUBLIC LICENSE version 3.