Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP session storage Unable to specify Redis database #15

Open
tangzhiqiangh opened this issue Jun 15, 2021 · 1 comment
Open

PHP session storage Unable to specify Redis database #15

tangzhiqiangh opened this issue Jun 15, 2021 · 1 comment

Comments

@tangzhiqiangh
Copy link

tangzhiqiangh commented Jun 15, 2021

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

@tangzhiqiangh tangzhiqiangh changed the title Unable to specify Redis database PHP session Unable to specify Redis database Jun 16, 2021
@tangzhiqiangh tangzhiqiangh changed the title PHP session Unable to specify Redis database PHP session storage Unable to specify Redis database Jun 16, 2021
1ma added a commit that referenced this issue Jun 25, 2021
@1ma
Copy link
Owner

1ma commented Jun 25, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants