Page 1 of 2
Desperate Help Needed With Session Problem!!!!
Posted: Mon Mar 31, 2003 4:19 pm
by Jade
I run an internet game where my members are tracked by sessions. When there sessions expire they are automatically logged out of the game. However, I'm having a big problem. My sessions are not lasting for the whole hour that I've defined them to, and yes, I'm using session_start() at the top of every page. I don't know what to do!!! I'm loosing members for my game because of this and I don't want that to happen. Can anyone help me???
Jade
Posted: Mon Mar 31, 2003 4:35 pm
by volka
maybe some debug-infos will help?
Code: Select all
<!-- making it a comment, not everyone needs to see it
<?php print_r(session_get_cookie_params()); ?>
-->
do the sessions expire before an hour has elapsed (and then how bad is it) or do the sessions never exist if it fails?
Posted: Mon Mar 31, 2003 4:52 pm
by Jade
The sessions start off just fine. However, after only a few minutes they seem to stop working. I keep setting the defined length of time to longer and longer but that doesn't seem to be helping at all. I'm not quite sure what the heck is going on and its driving me nuts!!!
Posted: Mon Mar 31, 2003 5:09 pm
by volka
is it possible that the session data files are stored in a directory that is the victim of a frantic garbage collection daemon? /tmp on some *nix-systems is more than just volatile...
I assume you've checked all parameters at
http://www.php.net/manual/en/ref.session.php that effect the session(-cookie) lifetime (?)
Posted: Mon Mar 31, 2003 5:21 pm
by Jade
My sessions are in /temp but I've never had this problem before. It seems like only lately that I've been having it and i haven't done anything different than before. I have fiddled around with the session configuration in php.ini and that doesn't seem to be helping much either. I'm not quite sure whats going on... I'm completely stumped.
Jade
Posted: Mon Mar 31, 2003 5:28 pm
by volka
what happens if you temporarily switch to
session.use_trans_sid = On?
Btw: any cookie is deleted by default when I close my browser but it also lets me change the ttl to any value I like

Posted: Mon Mar 31, 2003 5:36 pm
by Jade
I have:
session.use_trans_sid = 1
and i believe that means its on...i think...
Jade
Posted: Mon Mar 31, 2003 5:48 pm
by volka
if it is enabled (and used) you will notice the PHPSESSID=<something> appended to all links. If your system relies on it (because cookies are blocked or misconfigured in some way or whatever) I would check wether url_rewriter.tags contains all tags you're using. One page using a link or similar not fetched by the rewriter and the session is gone...
My sessions are in /temp
if you can reproduce the error you might keep track of one of those files. Is it deleted or the content wiped out?
Posted: Tue Apr 01, 2003 3:35 pm
by Jade
I do get PHPSESSID=<something> when you login. Like i said my sessions were working just fine a while ago. Now that I have more members on my game (10-25+ on at a single time) my members seem to be continually logged out. The only thing in the /temp that is being deleted are the sessions once they expire...only they ARE lasting for the time that they are supposed. I'm not quite sure what the heck is going on...
Jade
Posted: Tue Apr 01, 2003 7:06 pm
by volka
it's probably the other way round, the sessions "expire" because the data is gone.
Have you checked
http://www.php.net/manual/en/ref.sessio ... axlifetime?
It might be the error occurs now because more members cause more requests that make php check more often for session-files that are considered as obsolete.
Posted: Tue Apr 01, 2003 8:37 pm
by Jade
Okay, I am on windows and it does say this:
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.
So could that be the problem? If so, how would i come up with a way to come up with garbage collecting? Sorry, I'm still kinda new to this.
Jade
Posted: Wed Apr 02, 2003 4:29 am
by volka
the refers to the filesystem used by windows.
The old FAT system (dos, win3.1, win9x ...) did not store the last time of access; if you have nt/w2k e.g. your filesystem is hopefully NTFS.
But is session.gc_maxlifetime set to something inappropriate?
(it's all guessing and gc_maxlifetime is a long shot)
Posted: Wed Apr 02, 2003 3:24 pm
by Jade
I'm on XP which is basically a newer version of NT. My session.gc_maxlifetime is set to an hour.
Jade
Posted: Wed Oct 06, 2004 5:40 pm
by SKJoy
u running kinda opposite trouble than of mine, still I am posting what I found assuming this might help sorting the solution out for you by others.
well, though the issue is very old, but as I could discover what really happens right now, i am posting.
this trouble is not a windows issue, but a PHP issue. it happens for the way GC is implemented in PHP.
when a request is made, PHP doesn't really check for the session time out for the requested session. instead, PHP checks the other sessions for time out & deletes the files if the session associated to that file is timed out.
so, your session will never be timed out, until another session request comes to PHP after the amount of time your session is suppose to time out.
this is not an issue any developer can solve, but this has to be solved by PHP itself (if you really find it a trouble like me, there are logics in favoure & against regarding what PHP does now). it's much like a trigger that fires to some wrong target.
Posted: Wed Oct 06, 2004 11:48 pm
by denlou
It could be possible he installed XP with Fat32, I've seen it happen to a person, poor guy.