Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/137063-few-questions-about-sessions/
Share on other sites

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

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.