What is garbage collection?

Posted by Pinki | Updated on

What is garbage collection?

It is an automated feature of PHP. When it runs, it removes all session data which are not accessed for a long time. It runs on /tmp directory which is the default session directory.

PHP directives which are used for garbage collection include:

  • session.gc_maxlifetime (default value, 1440)
  • session.gc_probability (default value, 1)
  • session.gc_divisor (default value, 100)

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers