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:,

0 Comments

Leave a Reply

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