How can the maximum duration of a session be influenced in PHP?
The maximum duration of a session in PHP can be influenced by adjusting the session.gc_maxlifetime directive in the php.ini file. This directive specifies the number of seconds after which data will be seen as garbage and cleaned up. By increasing this value, the session duration can be extended.
// Set the maximum duration of a session to 1 hour (3600 seconds)
ini_set('session.gc_maxlifetime', 3600);
Related Questions
- How can inadequate question formulation or lack of background information impact the resolution of PHP-related issues on forums?
- How can PHP developers effectively test and debug the construction of messages for API communication via socket connections?
- Are there any potential pitfalls or security risks associated with using user input directly in a PHP query like in the provided code snippet?