Search code examples
phpsessionredisphpredis

How do I know if sessions are successfully being managed by redis?


I've set my values in my PHP.ini as shown below. Redis works and the sessions work. Now what I really wonder is How do I know that sessions are being handles & stored at Redis? I've searched everywhere and I cant find how would I validate that is working with Redis.

I need to be able to check somehow that the sessions are stored there.

session.save_handler = redis
session.save_path = "tcp://host1:6379"
extension=redis.so

my PHP info shows

session.name    PHPSESSID   PHPSESSID

Solution

  • If your sessions were being successfully managed by redis, you would see new keys being added to redis when a session is created.

    You can ask redis to list its keys on the command line:

    $ redis-cli keys "*"
    1) "some-redis-session-keys"
    2) "should-be-in-this-list"