stale session files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jonathan N. Little

    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

  • Dennis Ålund

    #2
    Re: stale session files

    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_prob ability = 1
    session.gc_divi sor = 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:

    and store session data in a database. It will give you much more
    control over the data.

    Comment

    Working...