468,290 Members | 1,946 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

stale session files

With all the security concerns and folks disabling JavaScript and
cookies I converted my site to PHP. Originally I use session cookie to
keep track of items our patrons selected on our gallery for checkout.
Since the cookie was just in the clients browser memory, garbage
collection was simple. Now with PHP sessions, patrons now do not have to
have cookies enabled to shop on our site, but since this is not a 'log
on' and 'log off' situation there is not an explicit 'log off' event to
destroy the session. The stale sessions files pile up. Is my only option
create a maintenance script to run periodically to delete session file >
24hrs old?
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Dec 6 '05 #1
1 1688
No, there is a garbage collector that will clear out old session files.
Every time a session starts it is (by default) 1 percent chance that it
will be run.
In php.ini
session.gc_probability = 1
session.gc_divisor = 100

Change this if you like. But it will also add some extra work to the
engine if you have high rate of visitors ( = collector runs too often).
If you want a neat session handling it's quite useful to take a look at
this:
http://se.php.net/manual/en/function...ve-handler.php
and store session data in a database. It will give you much more
control over the data.

Dec 6 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.