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