How to change the PHP session timeout value for a hosting account

The PHP session timeout variable is named session.gc_maxlifetime and its value can be adjusted if you would like to, say, extend the amount of time someone is allowed to remain inactive when signed in to a PHP app before the session is terminated.

This easy tutorial shows you how to adjust the PHP session timeout value for your hosting account should you wish to use a different session length for your PHP apps.

To change the PHP session timeout value:

  1. Sign in to your HostM hosting account’s cPanel.

    Your cPanel access details are listed on the hosting account’s Info page in the Client Lounge.

  2. Under the Software heading, select Select PHP Version.

  3. Select Options at the top of the page.

  4. Select the current value for session.gc_maxlifetime.

  5. Enter a new value into the field as desired.

    Keep in mind that the value for session.gc_maxlifetime is specified in seconds.

Your new PHP session timeout value should take effect immediately.

The PHP session timeout value affects all PHP apps on the same hosting account.

If you’d like to set a different session timeout value for a specific PHP app, check to see if the app comes with its own method of adjusting the value.

If you’re familiar with PHP coding, you can use ini_set("session.gc_maxlifetime", $timeout); in your app’s PHP code to set the timeout to the value assigned to the variable $timeout.


Love our guides? HostM offers professional and helpful web hosting services with unlimited features and renewal rates that actually match our advertised rates.