What php.ini settings are needed to keep the session active for about two days?

http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime

says session.cookie_lifetime 0 "goes until the browser closes." Is this the absolute maximum length that a session can have (always wiped when the browser is closed), or will it set session.cookie_lifetime, say 23243245234, a result that will probably continue whenever the browser is closed?

To some extent, what php.ini settings do I need to configure so that the sessions take up space for about two days, and is there a security reason to recommend a specific (I expect a lower) deadline, and if so, what was would the recommended period be?

Intended behavior Change: This is what I want to achieve, maybe I can understand the behavior by getting some suggestions for settings, and not specific values ​​of php.ini parameters:

I want the session to last as long as possible, up to (approximately) two days. If the session can go beyond the browser, I would like it to do this (up to two days).

What would I set for php.ini settings (and yes, I have direct editing access to php.ini) to achieve this?

+5
source share
5 answers

There are two options that you need to worry about sessions. The first is the TTL for the cookie, the other is how old the session data file may be before it receives the garbage collected.

session.cookie_lifetime , , cookie, , . 0, , . 172800 .

session.gc_maxlifetime , , , , , .

ini , , , .

. PHP , GC , , session.gc_maxlifetime . , , PHP , /tmp, .

+11

, .

, cookie, , onclose .

session.cookie_lifetime cookie

, . , , - ( ), . .

, ,

60 [] * 60 [] * 48 [] = 172800

+4

-, , , .

.

-, PHP, , , , , . , id .

, , cookie , .

0: cookie .

0: . , , cookie .

, , - cookie, , .

php.ini, session_get_cookie_params session_set_cookie_params

. , SessionID . cookie , .

0 , cookie, . , cookie .

0 , cookie . . 172800 (2 ), cookie 2 . , cookie , 2 .

0

0 , , , cookie , , . , (, logout), .

+1

, .....

"" , ... "Cookies" , .

"" "Cookies" . . "Cookies" .

0

( )

session.gc_maxlifetime 172800 session.cookie_lifetime 0.


session.gc_maxlifetime - . 172800 172800 (). , . . : PHP 30 ? .

cookie 0, cookie .

0

All Articles