Re: $_Session vs $_Cookie
| From: | Torsten Roehr | Date: | Mon, 31 May 2004 09:33:01 +0000 |
| Subject: | Re: $_Session vs $_Cookie | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34592@lists.php.net to get a copy of this message | ||
"Ng Hwee Hwee" <hhwee@towa.com.sg> wrote in message
news:002301c446ee$d1160ae0$7a01a8c0@hweehwee...
> Hi all,
>
> I have a problem: my $_SESSION variables and $_COOKIE variables get
> destroyed very often, even though my clients are actively browsing the
site
> (that means, the variables should not be garbage collected).
>
> Our guess is that the network connections are weak. My server is in
> Singapore but my clients are connecting to it from Japan, Thailand,
> Australia (some on dial-up) etc... Apparently, their connections get
dropped
> pretty frequently. Thus, their $_SESSION variables and $_COOKIE variables
> get destroyed everytime their connections are dropped.
>
> Has anyone experienced such phenomenon before? is our guess accurate? if
it
> is, does it mean that the best solution would be to change all our
$_SESSION
> variables to $_COOKIE and set an expiry date to the cookies to 12 hours
> later or something..
Hi Hwee,
you should not store more than the session id in a cookie. The session data
itself belongs into $_SESSION.
> fyi, i'm using PHP4.2.2 and my session.gc_maxlifetime = 1440 and
> session.gc_probability = 1. I will be upgrading to 4.3.6 in the near
future.
Your gc_maxlifetime setting is set to 1440 seconds which means 24 minutes.
So every 24 minutes the garbage collection is checked if it should be
deleted (based on gc_probability). Try increasing your gc_maxlifetime to a
higher value, e.g. 43200 for 12 hours.
Regards, Torsten
>
> thanks in advance!
>
> hwee