PHP Session Lifetime Setting: session.gc_maxlifetime

Introduction

The PHP session lifetime setting session.gc_maxlifetime defines the maximum validity period for PHP sessions. By specifying this maximum duration, you can configure how long PHP sessions remain active before they are considered “garbage.”


To adjust the PHP session setting session.gc_maxlifetime, first log in to our Customer Center at account.creoline.com using your login credentials.


Use the navigation menu to select the server under Server for which you want to change the PHP settings. Then open the Plesk Control Panel via the Plesk Control Panel menu item.


If this menu item is not displayed on your server, you can find additional ways to log in in the article Logging In to the Plesk Control Panel.



Customizing Settings for a Single Domain

Once you’re logged in to Plesk, you can select the domain using the global search or the Subscriptions menu item.




Use the PHP Settings button to configure the general PHP settings and additional directives:



The value session.gc_maxlifetime defines the maximum session lifetime for PHP sessions. This value can be set freely and is specified in seconds.


After the settings are saved, the web server automatically reloads the configuration using a graceful restart, so that existing requests are not terminated but rather paused.



Adjustment for All Domains

To increase or decrease the PHP setting for all domains using a specific PHP version, you must edit the PHP configuration file php.ini. To do this, select PHP Settings from the Tools & Settings menu in the left sidebar.



Then click on the PHP version for which you want to adjust the setting globally.

The php.ini tab gives you access to the PHP configuration file:



In the text field, search for the term session.gc_maxlifetime and replace the specified value with the desired new value. The default setting in Plesk is 1440 (seconds), or 24 minutes.


Then click the OK button to save the changes. The changes take effect immediately for all subscriptions that have the selected PHP version configured and have not been overridden using the custom PHP setting.