How long does a PHP session last for?

Posted by Prem Tiwari | Updated on

By default, session data will last for 24 minutes or 1440 seconds in PHP. But if you want, you can change the duration by modifying the value of gc_maxlifetime directive in php.ini file.

To set the session time for 30 minutes, open php.ini file and set the value of gc_maxlifetime directive as follows,
gc_maxlifetime = 1800


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