When PHP uses Redis as the session's Save tool, the user is not able to log on when the session is cleaned up.
How can i solve this problem?
I use two ways to define the session's preservation mechanism
One is
php
ini_set('session.save_handler','Redis');ini_set('session.save_path','tcp://localhost:6379');
The other is
session.save_handler = Redissession.save_path = "tcp://localhost:6379"
php5.3.28 and 5.5.10 are not able to use the session normally
But they can not be used, how to solve the heroes
Ps
@woshicixide said I didn't write the details, so I'm going to write all the steps again.
The first is to turn on Redis using script redis-server.exe redis.conf
commands to run the Redis server
Then modify the Session.save_handler to Redis in the php.inisession.save_handler = Redis
Then modify Session.save_path as "tcp://localhost:6379" in php.inisession.save_path = "tcp://localhost:6379"
Then restart the Apache service, Reload PHP.ini
Open login page http://localhost/login.php Enter user name password login
The browser automatically jumps to the login Success page and then automatically returns to the landing page
ps 在loginaction.php中将登陆的userid写入到session中来判断是否登陆
Reply content:
When PHP uses Redis as the session's Save tool, the user is not able to log on when the session is cleaned up.
How can i solve this problem?
I use two ways to define the session's preservation mechanism
One is
php
ini_set('session.save_handler','Redis');ini_set('session.save_path','tcp://localhost:6379');
The other is
session.save_handler = Redissession.save_path = "tcp://localhost:6379"
php5.3.28 and 5.5.10 are not able to use the session normally
But they can not be used, how to solve the heroes
Ps
@woshicixide said I didn't write the details, so I'm going to write all the steps again.
The first is to turn on Redis using script redis-server.exe redis.conf
commands to run the Redis server
Then modify the Session.save_handler to Redis in the php.inisession.save_handler = Redis
Then modify Session.save_path as "tcp://localhost:6379" in php.inisession.save_path = "tcp://localhost:6379"
Then restart the Apache service, Reload PHP.ini
Open login page http://localhost/login.php Enter user name password login
The browser automatically jumps to the login Success page and then automatically returns to the landing page
ps 在loginaction.php中将登陆的userid写入到session中来判断是否登陆
I feel you have a problem with the configuration, I put my configuration.
[Session]
; Handler used to store/retrieve data.
; Http://php.net/session.save-handler
Session.save_handler = Redis
Session.save_path = "Tcp://xx.xx.xx.xx:6789?persistent=1&timeout=3&database=11&auth= D9cxa2xx67f2xxxxxxxxxxxx58exx5xfxd29 "
I don't know if your redis is up or not, and whether your Web server is up or not, there are no exceptions. What about Redis extensions?
Landlord's question is too big, as if the user is asking why I do not open the site, the landlord at least the hint of what is wrong, how you call and so on such things write out
Determine if your Redis needs an account password, and then try to change the PHP configuration inside localhost to 127.0.0.1
In fact, I prefer to use memcahced to store the session data!
The reasons are as follows:
1. No need to set a password
2. Simple data structure and fast response time
3. Do the distribution is very convenient, a machine dedicated to the session, do share