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

When do session files get erased?

P: n/a
I am using filebased sessions with and they get created in a folder
called c:\php5apps\sessions

I have cookies enabled. I clear the cookies, but when to the session
files eventually get erased?

Does PHP check the sessions folder everytime for expired sessions and
erase them?

Thanks

Jul 7 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
*** ImOk escribió/wrote (7 Jul 2006 10:45:07 -0700):
I have cookies enabled. I clear the cookies, but when to the session
files eventually get erased?

Does PHP check the sessions folder everytime for expired sessions and
erase them?
Not every time, just randomly.

The behaviour is defined by these directives:

session.gc_probability
session.gc_divisor
session.gc_maxlifetime

From manual:

"session.gc_divisor coupled with session.gc_probability defines the
probability that the gc (garbage collection) process is started on every
session initialization. The probability is calculated by using
gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the
GC process starts on each request. session.gc_divisor defaults to 100."
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Jul 7 '06 #2

P: n/a
Weird way of doing it. I guess one can set the probability to 100% to
do this every time.
But thanks, I will read about it more in the manual.

Alvaro G. Vicario wrote:
*** ImOk escribió/wrote (7 Jul 2006 10:45:07 -0700):
I have cookies enabled. I clear the cookies, but when to the session
files eventually get erased?

Does PHP check the sessions folder everytime for expired sessions and
erase them?

Not every time, just randomly.

The behaviour is defined by these directives:

session.gc_probability
session.gc_divisor
session.gc_maxlifetime

From manual:

"session.gc_divisor coupled with session.gc_probability defines the
probability that the gc (garbage collection) process is started on every
session initialization. The probability is calculated by using
gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the
GC process starts on each request. session.gc_divisor defaults to 100."
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Jul 8 '06 #3

P: n/a
ImOk wrote:
Weird way of doing it. I guess one can set the probability to 100% to
do this every time.
But thanks, I will read about it more in the manual.

Alvaro G. Vicario wrote:
>>*** ImOk escribió/wrote (7 Jul 2006 10:45:07 -0700):
>>>I have cookies enabled. I clear the cookies, but when to the session
files eventually get erased?

Does PHP check the sessions folder everytime for expired sessions and
erase them?

Not every time, just randomly.

The behaviour is defined by these directives:

session.gc_probability
session.gc_divisor
session.gc_maxlifetime

From manual:

"session.gc_divisor coupled with session.gc_probability defines the
probability that the gc (garbage collection) process is started on every
session initialization. The probability is calculated by using
gc_probability/gc_divisor, e.g. 1/100 means there is a 1% chance that the
GC process starts on each request. session.gc_divisor defaults to 100."
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--

Actually, it makes a lot of sense. The heavier the load, the more often
the gc runs.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jul 8 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.