Reading, Writing and Destroying Sessions5:27 with Alena Holligan
A "Session" is a term referring to a user's time browsing a web site. It's meant to represent the time between a user's first page view on a particular site, until the time that user is finished at that site. PHP offers us the ability work with "session variables" which are available for the duration of a user's session
Learn more about Escaping Output
Changing Session Timeout
By default the session timeout is 1440 seconds, which is 24 minutes. One of the most basic examples to change the session timeout is as follows:
// 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); session_start();
For more details on PHP settings, check out the course on Basic Error Handling in PHP.
You need to sign up for Treehouse in order to download course files.Sign up