How long does an active session last for a logged-in user in PHP, and can it be adjusted?
By default, an active session lasts for 24 minutes in PHP. This can be adjusted by changing the session.gc_maxlifetime value in the php.ini file or by using the session_set_cookie_params() function to set the session cookie expiration time in the PHP script.
// Set the session cookie expiration time to 1 hour
session_set_cookie_params(3600);
session_start();
Keywords
Related Questions
- How can PHP be used to change the date format from "2004-05-22" to "22.05.2004"?
- What potential pitfalls can arise when comparing integers with strings in PHP, as seen in the code provided?
- What is the best way to restrict input to a specific pattern, such as "Number, Number, Letter, Letter, Number, Number" in PHP?