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
- What are some common pitfalls to avoid when working with PHP and MySQL together in a web application?
- How can one ensure that error messages are displayed on the same page after form submission in PHP?
- What are some common pitfalls when using LIKE queries in PHP to search for multiple criteria in a database?