Chris Rosillo
Chris Rosillo

Reputation: 363

Redis key prefix when using it as a PHP session handler...?

I'm using Redis as a PHP session handler.

In my Apache vhost I have the following: php_value session.save_path "tcp://10.179.192.173:6379" php_value session.save_handler "redis"

The default key prefix for PHP sessions is "PHPREDIS_SESSION:".

How do I change this?

I've seen various examples tacking on arguments to the save_path such as "tcp://10.179.192.173:6379?timeout=1" but can't see find anything on setting the prefix.

The following blog post mentions that it is possible, but doesn't explain how: http://phpave.com/redis-as-a-php-session-handler/#.Uos6xGRmWjQ

Anyone know the answer?

Thanks, Chris

Upvotes: 5

Views: 10765

Answers (2)

Chris Rosillo
Chris Rosillo

Reputation: 363

Found the answer, reading the manual.

For anyone who's looking for this see: https://github.com/phpredis/phpredis#php-session-handler

Under the title, "PHP Session handler", lies a list of possible arguments.

Upvotes: 9

Floris Groenendijk
Floris Groenendijk

Reputation: 172

And the answer is to use the prefix in session.save_path.

tcp://10.179.192.173:6379?prefix=PREFIX_SESSION:

Don't forget the colon :

Upvotes: 13

Related Questions