RE: [PHP] session life
| From: | Jason Sheets | Date: | Sat, 21 Dec 2002 19:01:26 +0000 |
| Subject: | RE: [PHP] session life | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129070@lists.php.net to get a copy of this message | ||
On Sat, 2002-12-21 at 08:03, John W. Holmes wrote:
> > I'm setting a session with
> > session_set_cookie_params (time()+6480000);
> > so the cookie should last 70 days+ but the data wasn't
> > returned.
> >
> > from looking in the manual i see that session_cache_expire is used to
> set
> > or print the current value of the expire. Its set in php.ini by
> default to
> > 180 minutes.
> >
> > So it seems that the garbage collector will clean up the session file
> > after 180 mins or 10800 seconds which is less then i was expecting
> after
> > setting the cookie life.
> >
> > do i need to set
> >
> > session_set_cookie_params (time()+6480000);
> > session_cache_expire (6480000);
> >
> > for the data to still be available if the user returns during the
> cookies
> > life and is this on a per session basis.
>
> Well, first of all, session cookies are deleted when the user closes
> their browser. So unless the user is leaving the browser open for 70
> days, this setting won't matter.
This is incorrect, by default session cookies have a lifetime of 0 which
means they are peresistent until the browser is closed. If you set the
ini directive session.cookie_lifetime to something other than 0, for
example 86400 then the session will for the number of seconds specified,
in this case 1 day, even after the browser has been closed.
>
> session.gc_lifetime is the setting that controls the garbage cleanup. If
> the session is inactive past that time limit, then the session file will
> be deleted.
>
> Sessions aren't meant to be a "remember me" function. You'll need to use
> regular cookies that persist after the browser is closed for that.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php