How can the session timeout duration be adjusted in the PHP.ini file to ensure sessions last for a specific period, such as 8 hours?
To adjust the session timeout duration in the PHP.ini file to ensure sessions last for a specific period, such as 8 hours, you can modify the "session.gc_maxlifetime" directive in the PHP configuration file. This directive sets the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. By setting this value to the desired duration in seconds (in this case, 8 hours would be 28800 seconds), you can make sessions last for the specified period.
// Set session timeout duration to 8 hours (28800 seconds)
ini_set('session.gc_maxlifetime', 28800);
Keywords
Related Questions
- What are some alternative approaches to using regular expressions in PHP for character validation in variables?
- Are there any best practices or specific techniques to handle cross-server communication and script execution in PHP?
- Are there any security considerations to keep in mind when implementing a system to allow users to download files with original names in PHP?