Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
| Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 28th, 2003, 09:31 AM
gkb gkb is offline
Registered User
Join Date: Jul 2003
Location: yong peng, johor, Malaysia.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to gkb
Default garbage collection can't work?

the pro php4 book had mention that we can use user defined session function as a replace of pre-defined session methods, that is implement session in mysql database.
but the problem is the garbage collection will not function at even i had set the lifetime collectly.
i read a article from www.phpbulder.com that we should call the session grabage collection function after session_start() and before any use of session variable.but why the grabage collection function won't work itself as usual? what is the actual problem?


Old July 31st, 2003, 02:06 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

What article on PHPBuilder said to explicitly call the garbage collector?

The garbage collection function simply cleans things up by deleting old, expired session data. There should be no reason to call this function in your script as it's only purpose is to free up dead space. The session data that WOULD be deleted should be marked as expired anyway, so those sessions should NOT be open-able or activated by your script.

When writing custome session handlers and storing session data in a database, the garbage collection function should be a simple query similar to the following:

$query = "DELETE FROM session_data WHERE expires < " . time();

Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
Garbage Collection azizur123 .NET Framework 2.0 1 February 3rd, 2008 11:16 AM
Garbage collection in VC++ chandugsekhar BOOK: Beginning Visual C++ 6 0 October 18th, 2006 12:09 PM
Garbage Collection Survey S.Marion General .NET 1 June 7th, 2005 12:46 PM
Garbage Collection... kk_katepally General .NET 1 December 21st, 2004 04:18 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.