PHP session storage Unable to specify Redis database
session.save_path = " tcp://127.0.0.1:6379?database=2 " Useless, the session cannot be stored in the specified reids database,What is the problem and how to solve it?
PHP 版本 7.3.8-1+ubuntu16.04.1+deb.sury.org+1 PHPRedis 版本 4.3.0 Redis 服务器 v=6.0.11
Difficult to tell from here. If the save_path works with phpredis it should work with this session handler, too.
For what it's worth, I added a test case that parses your save_path and works as intended. But the other ones use localhost instead of 127.0.0.1, maybe you could try changing that. If not, maybe the Redis service is not reachable for some reason.
At any rate I encourage you to use phpredis, the problems its session manager had (and the reason I created this package) have already been solved there. Just make sure you have redis.session.locking_enabled=1 and session.use_strict_mode=1 in your php.ini file.
Edit: Now I realized you use phpredis 4.3.0, this version supports session locking but not strict_mode. To solve both issues you should be on phpredis 5.2.x or above.