How to Increase Default Session Timeout: PHP Code Examples

How to Increase & Set the Default Session Timeout in PHP Code Snippet We recommend that you use the session.gc_maxlifetime environment setting whenever you want to increase the default session timeout. This can be done in the code or INI file. You can also use the global $_SESSION array to increase the default session timeout. // session shoud last for atleast one hour. ini_set('session.gc_maxlifetime', 3600); session_start(); // start the session! Not sure what sessions are? Want to see other ways of increasing session expiration time in PHP? Just stay with us until the end to learn more. More about PHP Default Sessions HTTP (Hyper Text Transfer Protocol) is a protocol for communication between web browsers (clients) and web servers. A standard set of rules establishes how the two entities should communicate over the web. The following figure illustrates a typical HTTP communication between a client and a web server. The…

read more