Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session store removal (for martinca)

Status
Not open for further replies.

sleipnir214

Programmer
May 6, 2002
15,350
US
Tek-Tips user martinca sent me this question in an email sent through the site's "Send a comment about this FAQ" feature. This comment was in response to my FAQ, "Using MySQL to store PHP session variables".

Since I do not respond to email from people I don't know (no offense, martinca), I will repeat the question here and provide my answer.

The question, verbatim:
hi I would like to know how I can destory sesssion id form my /tmp directory and alos when someone closes the browser the session id should die please advice thanks


martinca:
A session consists of two parts: a session store on the server and a cookie on the browser.

The cookie is set with no expiration, which means whenever the web browser is shut down, it deletes all session cookies it knows about.

Removal of PHP session stores (whether on the server filesystem or in a database) are handled by PHP's session garbage collection system. There is a random chance (set as a percent in the runtime configuration directive "session.gc_probability") that the garbage collection mechanism will operate every time a session is started. If you set this value to 100, garbage collection will run every time a session starts.

The runtime configuration directive "session.gc_maxlifetime" tells PHP in seconds how long a session store must have existed before the gargage collection mechanism removes it.

If the session cookie is deleted by the browser's shutdown, the session no longer works, even if the session store still exists on the filesystem.

If the session store is deleted, the session no longer works, even if the cookie still exists on the client. Want the best answers? Ask the best questions: TANSTAAFL!
 
thats good to know. i should have read it in the manual but since i never ran into problems i didnt. thanks for the info sleipnir :) what we see depends mainly on what we're looking for.
--unknown
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top