For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > May 2004 > Re: [PHP-DB] Re: $_Session vs $_Cookie









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Re: $_Session vs $_Cookie
Ng Hwee Hwee

2004-05-31, 7:31 am

hi..

the situation is like this: my clients' $_SESSION gets destroyed even after
only a few seconds of inactivity! so, with my current setting for
gc_maxlifetime (1440), it should be more than enough to have their sessions
registered for the few minutes, right? thus, i deduce that the solution may
not lie in my gc_maxlifetime value?? please correct me if I'm wrong!

thanx thanx!

----- Original Message -----
From: "Torsten Roehr" <roehr@zilleon.com>
To: <php-db@lists.php.net>
Sent: Monday, May 31, 2004 5:33 PM
Subject: [PHP-DB] Re: $_Session vs $_Cookie


> "Ng Hwee Hwee" <hhwee@towa.com.sg> wrote in message
> news:002301c446ee$d1160ae0$7a01a8c0@hwee
hwee...
> 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

Torsten Roehr

2004-05-31, 7:31 am

"Ng Hwee Hwee" <hhwee@towa.com.sg> wrote in message
news:005201c446f7$848fcea0$7a01a8c0@hwee
hwee...
> hi..
>
> the situation is like this: my clients' $_SESSION gets destroyed even

after
> only a few seconds of inactivity! so, with my current setting for
> gc_maxlifetime (1440), it should be more than enough to have their

sessions
> registered for the few minutes, right? thus, i deduce that the solution

may
> not lie in my gc_maxlifetime value?? please correct me if I'm wrong!


You're right, the session should at least be active for the specified
gc_maxlifetime - no matter if the users click a link or not. So even if the
user clicks only once to start the session and then clicks again after 20
minutes the session should still be valid. If it's not I guess there is
something wrong on your server because the session should be alive even if
the user is not requesting any pages. Do all users have this problem and do
you have it yourself?

Torsten
Ng Hwee Hwee

2004-05-31, 7:31 am

i do not really experience this problem.. i can click through the links
easily.. hmm.. your question sets me thinking.. do you think it has to do
with some VPN thing? my system is an intranet system and the users log on to
it through a VPN.. do you think it will cut my sessions?!

by the way, I saw this note on php.net under the gc_maxlifetime section:

Note: If you are using the default file-based session handler, your
filesystem must keep track of access times (atime). Windows FAT does not so
you will have to come up with another way to handle garbage collecting your
session if you are stuck with a FAT filesystem or any other fs where atime
tracking is not available. Since PHP 4.2.3 it has used mtime (modified date)
instead of atime. So, you won't have problems with filesystems where atime
tracking is not available.

do you think by upgrading it will solve all my problems?!

thanx a million!!

----- Original Message -----
From: "Torsten Roehr" <roehr@zilleon.com>
To: <php-db@lists.php.net>
Sent: Monday, May 31, 2004 6:19 PM
Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie


> "Ng Hwee Hwee" <hhwee@towa.com.sg> wrote in message
> news:005201c446f7$848fcea0$7a01a8c0@hwee
hwee...
> after
> sessions
> may
>
> You're right, the session should at least be active for the specified
> gc_maxlifetime - no matter if the users click a link or not. So even if

the
> user clicks only once to start the session and then clicks again after 20
> minutes the session should still be valid. If it's not I guess there is
> something wrong on your server because the session should be alive even if
> the user is not requesting any pages. Do all users have this problem and

do
> you have it yourself?
>
> Torsten

Torsten Roehr

2004-05-31, 7:31 am

"Ng Hwee Hwee" <hhwee@towa.com.sg> wrote in message
news:006201c446fa$97578480$7a01a8c0@hwee
hwee...
> i do not really experience this problem.. i can click through the links
> easily.. hmm.. your question sets me thinking.. do you think it has to do
> with some VPN thing? my system is an intranet system and the users log on

to
> it through a VPN.. do you think it will cut my sessions?!


I don't have any experience with VPNs. Does it work for you if you are
logging in via VPN?

>
> by the way, I saw this note on php.net under the gc_maxlifetime section:
>
> Note: If you are using the default file-based session handler, your
> filesystem must keep track of access times (atime). Windows FAT does not

so
> you will have to come up with another way to handle garbage collecting

your
> session if you are stuck with a FAT filesystem or any other fs where atime
> tracking is not available. Since PHP 4.2.3 it has used mtime (modified

date)
> instead of atime. So, you won't have problems with filesystems where atime
> tracking is not available.


Is your server running on Windows? Have you tried using a database as your
session container?
[color=darkred]
> do you think by upgrading it will solve all my problems?!
>
> thanx a million!!
>
> ----- Original Message -----
> From: "Torsten Roehr" <roehr@zilleon.com>
> To: <php-db@lists.php.net>
> Sent: Monday, May 31, 2004 6:19 PM
> Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie
>
>
solution[color=darkred]
> the
20[color=darkred]
if[color=darkred]
> do
Ng Hwee Hwee

2004-05-31, 11:31 pm

Hi Sukanto,

I'm glad I'm not alone. :o) I'm working on an intranet, thus i can ask my
staff to enable their cookies.. but this is really not the best way.

Right now, I am trying to convert all my sessions to cookies because this is
a faster solution to solve my urgent problem. But I think as recommended by
Torsten and the others, maybe we should use the database to save our
sessions.. I do not have time to explore the PEAR packages but they look
like a good long-term solution.

By the way, do you use VPN?

Hwee

----- Original Message -----
From: "Sukanto Kho" <starofflame@hotmail.com>
To: "Ng Hwee Hwee" <hhwee@towa.com.sg>
Sent: Tuesday, June 01, 2004 9:31 AM
Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie


> Hi Hwee,
>
> I experience such problem too.. I'm hosting my web at spore.
>
> Sometimes not all the time ...my session just deleted from web server...
>
> I also guest that its a weak network that cause such problem.
>
> Otherwise I dont get any ideas.
>
> So whats ur solution then?? u change all session to cookie (I prefer not

to[color=darkred]
> use cookie)
>
>
> ----- Original Message -----
> From: "Ng Hwee Hwee" <hhwee@towa.com.sg>
> To: "DBList" <php-db@lists.php.net>
> Sent: Monday, May 31, 2004 5:10 PM
> Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie
>
>
> after
> sessions
> may
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com