Search Our Database

How to Adjust Session Lifetime for All Websites using MultiPHP INI Editor in cPanel

Last updated on |
by

Introduction

This Knowledge Base article provides a concise, step-by-step guide on How to Adjust Session Lifetime for All Websites using MultiPHP INI Editor in cPanel. The session.gc_maxlifetime directive specifies the number of seconds after which session data will be considered garbage and potentially cleaned up. By applying this setting to your Home Directory, you can configure session lifetime across all domains under your hosting account, which is important for controlling how long users remain logged in to your web applications.

Prerequisite

  • Access to your cPanel login page.

Step-by-Step Guide

Step 1: Log in to cPanel

  • Access and log in to your cPanel account using your username and password.

Step 2: Open MultiPHP INI Editor

  • In the Home page, under Software, click MultiPHP INI Editor.

Step 3: Access Basic Mode

  • The interface will open in the Basic Mode tab by default.
  • If you are in Editor Mode, click the Basic Mode tab at the top of the interface.

Step 4: Select Home Directory

  • From the Configure PHP INI basic settings dropdown menu, select Home Directory.

⚠️ Important Note: Selecting Home Directory will apply PHP configuration changes to all domains.

Step 5: Adjust Session Lifetime

  • Locate the session.gc_maxlifetime directive in the list of PHP directives.
  • Enter the desired lifetime in seconds (e.g., 3600 for 1 hour, 7200 for 2 hours, 86400 for 24 hours).
  • The default value is typically 1440 seconds (24 minutes).

⚠️ Important Note:

  • Setting this value too high may pose security risks as inactive sessions will remain valid for extended periods.
  • Setting it too low may cause users to be logged out frequently.

Step 6: Apply the Changes

  • Click the Apply button at the bottom of the page to apply the changes made.

Step 7: Verify the Changes

  • A successful message will pop up to confirm that the changes is applied successfully.
  • Alternatively, test user session behavior to ensure sessions expire at the expected time.

⚠️ Important Note:

  • The actual session cleanup depends on the garbage collection probability settings and may not occur exactly at the specified time.

Conclusion

By following these steps, you can adjust session lifetime for all websites using MultiPHP INI Editor in cPanel. This allows you to control how long user sessions remain active across all your websites, balancing security with user convenience.

Should you encounter any issues or have any questions, our support team at IPSERVERONE is always here to assist you. Don’t hesitate to reach out to us at support@ipserverone.com for any help you need.