PHP Session Lifespan

|

So I ran into an interesting comment left on the manual page for session_cache_expire.

...

The garbage collector controls the session data and destroys sessions which are older then 1440 seconds (24 minutes) by default.

So to keep a session alive longer then 24 minutes (for example when a visitor tries to POST a huge message that took him 1 hour to type), you must modify the session.gc_maxlifetime thru ini_set()

Somehow i couldn't find anything in the PHP documentation regarding this and due to that me (and i think many others) got the wrong ideas regarding PHP sessions.

A few examples to fix session timeout are already posted below but in my opinion they all missed session.gc_maxlifetime

To say that people may be missing this may be an understatement.

About this Entry

This page contains a single entry by Patrick published on September 28, 2005 1:34 PM.

Savages was the previous entry in this blog.

What's Up? is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.01