Welcome Guest, Not a member yet? Register   Sign In
Session garbage collection
#3

(11-04-2015, 10:33 AM)mwhitney Wrote: PHP's garbage collection for sessions is controlled by session.gc_probability, session.gc_divisor, and session.gc_maxlifetime in php.ini. Generally, these can also be set in .htaccess, httpd.conf, via ini_set(), or, since PHP 5.3, in .user.ini.

However, many Linux configurations actually disable this by setting session.gc_probability to 0, then use a cron job or some other method to cleanup the default location for PHP sessions based on the session.gc_maxlifetime value. While this has the benefit of not triggering session cleanup specifically when a user visits the site, you would have to modify the existing cron job or create a new one to cleanup your session location, or use the default session location (generally stored in session.save_path).

If you use a session driver other than the file driver, it's a little more difficult to clean up the old sessions by doing anything other than setting the session.gc_* variables to reasonable values.

Thanks for that!

So this could mean that my local machine is not collecting the garbage, but my hosting server could be doing it correctly.
Reply


Messages In This Thread
Session garbage collection - by Martin7483 - 11-04-2015, 06:15 AM
RE: Session garbage collection - by mwhitney - 11-04-2015, 10:33 AM
RE: Session garbage collection - by Martin7483 - 11-05-2015, 03:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB