Google News
logo
PHP - Interview Questions
What is default session time and path in PHP. How to change it?
The default session time in PHP is 1440 seconds (24 minutes) and the Default session storage path is temporary folder/tmp on the server.
 
You can change default session time by using below code
 
<?php
 // server should keep session data 
    for AT LEAST 1 hour
    ini_set('session.gc_maxlifetime', 3600);

 // each client should remember their 
    session id for EXACTLY 1 hour
    session_set_cookie_params(3600);
?>
Advertisement