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);