Ivan Tomica

Redis as PHP session handler on FreeBSD

This one is quite simple to be honest. Assuming you have Redis already installed and set up correctly you can just change your php-fpm pool definition to include:

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

If you’re using password for logging into redis you would specify it like:

php_value[session.save_path]    = "tcp://127.0.0.1:6379?auth=PASSWORD"

Restart php-fpm after that:

service php-fpm restart

and you should now see PHP saving sessions within Redis service:

127.0.0.1:6379> keys PHPREDIS_SESSION*
1) "PHPREDIS_SESSION:GFtHQ69XH6C7xe5LLYzhJ35zUQACJw"
...
Tagged in:,
About 
Sysadmin on the everlasting journey of learning. Always in search for an opportunity to prove myself and to learn something new. My addiction is learning and my main goal is to excel in every aspect of Linux/Unix system administration.

0 Comments

Leave a Reply

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