By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,018 Members | 1,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,018 IT Pros & Developers. It's quick & easy.

How Session getting expired?

P: n/a
Hello Friends,

I am new to this group so big HIIIIIIII to all :) fine i have a
serious doubt about session handling in PHP. After 20 min (default
time) session getting expired, session values are stored in a folder
as a file, fine how php finiding that particular session expired?
Because the files in session folder will not be deleted after 20 min
but one session expired...

Please explain me how this is happening? How php finds that particular
session is ideal for 20 min.

Hope this is an easy question.

Thanx in advance

Regards,
Sriram
Jun 2 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
..oO(sriram)
>I am new to this group so big HIIIIIIII to all :) fine i have a
serious doubt about session handling in PHP. After 20 min (default
time) session getting expired, session values are stored in a folder
as a file, fine how php finiding that particular session expired?
Because the files in session folder will not be deleted after 20 min
but one session expired...

Please explain me how this is happening? How php finds that particular
session is ideal for 20 min.
Probably by looking at the date when the file was changed. If it wasn't
changed in the last 20 minutes, the session times out. But this doesn't
mean that the file will be removed immediately. Cleaning up is done by
the garbage collector, which fires every now and then, but not on every
request for performance reasons. Its behaviour can be controlled with
some ini settings.

Micha
Jun 2 '08 #2

P: n/a
sriram wrote:
Hello Friends,

I am new to this group so big HIIIIIIII to all :) fine i have a
serious doubt about session handling in PHP. After 20 min (default
time) session getting expired, session values are stored in a folder
as a file, fine how php finiding that particular session expired?
Because the files in session folder will not be deleted after 20 min
but one session expired...

Please explain me how this is happening? How php finds that particular
session is ideal for 20 min.

Hope this is an easy question.

Thanx in advance

Regards,
Sriram
PHP keeps track of the session timeout internally (maybe in the session
file itself - I never looked). It does not necessarily clean up expired
session files immediately. But they should be deleted eventually.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #3

P: n/a
On May 6, 9:21 pm, Michael Fesser <neti...@gmx.dewrote:
.oO(sriram)
I am new to this group so big HIIIIIIII to all :) fine i have a
serious doubt about session handling in PHP. After 20 min (default
time) session getting expired, session values are stored in a folder
as a file, fine how php finiding that particular session expired?
Because the files in session folder will not be deleted after 20 min
but one session expired...
Please explain me how this is happening? How php finds that particular
session is ideal for 20 min.

Probably by looking at the date when the file was changed. If it wasn't
changed in the last 20 minutes, the session times out. But this doesn't
mean that the file will be removed immediately. Cleaning up is done by
the garbage collector, which fires every now and then, but not on every
request for performance reasons. Its behaviour can be controlled with
some ini settings.

Micha
Thanx for all... I think Micha is right, i thought that either. Will
do a check on it. So Micha, as you told if a session is expired after
20 min. Without refreshing the page (bec once i refresh PHP will find
the session expired) if i just do some changes in that particular
session file by opening it in an editor, then again that particular
session becomes active right? This is what you answer means.. I will
try that and let you know....

Regards,
Sriram
Jun 2 '08 #4

P: n/a
..oO(sriram)
>Thanx for all... I think Micha is right, i thought that either. Will
do a check on it. So Micha, as you told if a session is expired after
20 min. Without refreshing the page (bec once i refresh PHP will find
the session expired) if i just do some changes in that particular
session file by opening it in an editor, then again that particular
session becomes active right?
Quite possible, I haven't tested it.
>This is what you answer means.. I will
try that and let you know....
OK.

Micha
Jun 2 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.