Desperate Help Needed With Session Problem!!!!
Moderator: General Moderators
Desperate Help Needed With Session Problem!!!!
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
Jade
maybe some debug-infos will help?do the sessions expire before an hour has elapsed (and then how bad is it) or do the sessions never exist if it fails?
Code: Select all
<!-- making it a comment, not everyone needs to see it
<?php print_r(session_get_cookie_params()); ?>
-->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 (?)
I assume you've checked all parameters at http://www.php.net/manual/en/ref.session.php that effect the session(-cookie) lifetime (?)
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
Jade
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
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
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...
if you can reproduce the error you might keep track of one of those files. Is it deleted or the content wiped out?My sessions are in /temp
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
Jade
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.
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.
Okay, I am on windows and it does say this:
Jade
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.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.
Jade
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)
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)
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.