[PHP-DB] Re: $_Session vs $_Cookie
Ng Hwee Hwee wrote: 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.. 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. thanks in advance! hwee Are you using a server cluster? If so, do you have some kind of session sharing set up? (Basically you have to either set up the same directory to be pointing to one machine or use a shared DB for session storage). -- paperCrane -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: $_Session vs $_Cookie
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" <[EMAIL PROTECTED]> To: "Ng Hwee Hwee" <[EMAIL PROTECTED]> 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 > use cookie) > > >From Flame Xie xi Chuan > > - Original Message - > From: "Ng Hwee Hwee" <[EMAIL PROTECTED]> > To: "DBList" <[EMAIL PROTECTED]> > Sent: Monday, May 31, 2004 5:10 PM > Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie > > > > 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! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: $_Session vs $_Cookie
"Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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? > do you think by upgrading it will solve all my problems?! > > thanx a million!! > > - Original Message - > From: "Torsten Roehr" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, May 31, 2004 6:19 PM > Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie > > > > "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: $_Session vs $_Cookie
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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 31, 2004 6:19 PM Subject: Re: [PHP-DB] Re: $_Session vs $_Cookie > "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: $_Session vs $_Cookie
"Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: $_Session vs $_Cookie
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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 31, 2004 5:33 PM Subject: [PHP-DB] Re: $_Session vs $_Cookie > "Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi all, > > 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: $_Session vs $_Cookie
"Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php