ryeguy Posted December 15, 2008 Share Posted December 15, 2008 I understand that ini_set("session.gc_maxlifetime", "time"); is used to set the lifetime of a session, but when it expires, is there anyway to recover the data? Is the session file actually deleted from the system when it expires? My other question is when you use session_regenerate_id() does this reset the session lifetime timer? Like, if a session's lifetime is 30 minutes, and I regenerate it at 25 minutes, does the new session id last for 30 minutes? Quote Link to comment https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/ Share on other sites More sharing options...
MasterACE14 Posted December 15, 2008 Share Posted December 15, 2008 I believe once the session has expired, that is it. It's dead and completely gone. Quote Link to comment https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/#findComment-715838 Share on other sites More sharing options...
ryeguy Posted December 15, 2008 Author Share Posted December 15, 2008 That's what I figured..anyone know anything about the other question? Quote Link to comment https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/#findComment-716244 Share on other sites More sharing options...
premiso Posted December 15, 2008 Share Posted December 15, 2008 The session will last as long as there is activity. So if session_start() is called anywhere in that 30 minutes it is extended by another 30 minutes. No need to regenerate the id. Quote Link to comment https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/#findComment-716255 Share on other sites More sharing options...
ryeguy Posted December 16, 2008 Author Share Posted December 16, 2008 The session will last as long as there is activity. So if session_start() is called anywhere in that 30 minutes it is extended by another 30 minutes. No need to regenerate the id. Are you sure? Is this guy wrong then? http://bytes.com/groups/php/10541-session-gc_maxlifetime Quote Link to comment https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/#findComment-716618 Share on other sites More sharing options...
revraz Posted December 16, 2008 Share Posted December 16, 2008 Even when it "expires" it is still there. It doesn't actually get removed until the Garbage Collector (GC) runs. And you can test it yourself how it works in regards to the maxlifetime. Quote Link to comment https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/#findComment-716651 Share on other sites More sharing options...
premiso Posted December 16, 2008 Share Posted December 16, 2008 The session will last as long as there is activity. So if session_start() is called anywhere in that 30 minutes it is extended by another 30 minutes. No need to regenerate the id. Are you sure? Is this guy wrong then? http://bytes.com/groups/php/10541-session-gc_maxlifetime Think about it, what good would sessions do if you can only stay on a site max 20 minutes period and you have to re-login after 20 minutes. The activity re-activates the session, look at banking sites etc. As long as you do something within the 20 minutes you stay logged in. Once you do not you are automatically logged out cause the session timed out. Think about the word "timed out" itself. A session timeout means that it did not receive a response in x amount of time, thus it timesout, if you send something to the server you essentially sent it a "ping" and told it you are still here, so the timer resets to 20 minutes. But as stated above, try it out for yourself, the only true way to know is testing it on your own. Quote Link to comment https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/#findComment-716720 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.