Let PHP session never expire, you may not encounter such a depressing problem, but I met, very depressed.
We have developed a system that only the company's customer service personnel can use-a limited number of customer service personnel. This is the limited number of customer service staff a few days ago suddenly put forward such a problem: we every very short period of time (half an hour does not operate the page), is anxious to solve the customer problem, the system is prompted to login, delayed the customer's time ... This is very unpleasant!
The client is God, the only God. So Shangfeng requirements We can implement PHP session never expires, unless our customer service personnel to let him out of date. For security reasons I do not understand this never expired behavior, for the reason of laziness I really do not want to modify the previous program. But there is no way, I still need to change.
Do not modify the program is the best way, because if you modify the program, the test department must be very depressed like me, then only modify the system environment configuration, in fact very simple, open the php.ini settings file, modify three lines as follows:
1, Session.use_cookies
Set this value to 1, using a cookie to pass the SessionID
2, Session.cookie_lifetime
This represents the SessionID in the client cookie store time, the default is 0, on behalf of the browser a close sessionid on the void ... That's why PHP's session cannot be used permanently! So let's set it to a number that we think is big, how about 999999999, it's OK!
3, Session.gc_maxlifetime
This is the session data stored on the server side of the time, if more than this time, then the session data will be automatically deleted! So we also set it to 99999999.
It's all OK, of course you don't believe it. Test it--set a session value after a 10-day half-month return to see if your computer is not powered down or down, you can still see the SessionID.
Of course, you may not be able to control the permissions of the server and not as lucky as I can modify the php.ini settings, all rely on our own also have a way, of course, we must use the client to store cookies, the SessionID stored in the client's cookie, Set the value of this cookie, and then pass this value to the session_id () function, as follows: