1. Home
  2. MageMojo Hosting
  3. Increase session time

Increase session time

By default, the Magento session timeouts are set to 3600 seconds or 1 hour.  If a customer visits your site, adds an item to cart, then comes back. They will find their session data has expired and the cart is empty.  To spare them the inconvenience of shopping again, you should raise the session time to at least 1 day.

The same logic applies to the Magento (1 and 2) admin. If you are working on your store every day, you may not want to log into every day and instead have your browser remember that you are logged in.

Set PHP Values

Before touching anything in Magento we need to set two PHP values:

  • session.gc_maxlifetime
  • session.cookie_lifetime

In the Advanced Options for any vhost, you can override the master values for just that vhost. They should look like this:

Add the above values and save the vhost/website configuration.

Set Magento 1 Lifetime

If you have a Magento 1 store, do the following to adjust the lifetime values.

  1. Log into your Magento admin dashboard
  2. Go to System-> Configuration-> Web
  3. Expand the Cookie Management section
  4. Set the Cookie Lifetime value to 86400 or your desire value and save the configuration.
  5. To adjust the admin cookie lifetime. Go to System->Configuration->Advanced->Admin
  6. Expand the security section.
  7. Set the Session Lifetime as in the above screenshot then save the configuration.
  8. Clear the Magento cache and your local browser cache to see the applied change.

Set Magento 2 Lifetime

  1. Log into your Magento 2 admin dashboard
  2. Go to Stores->Configuration->General->Web
  3. Expand the Default Cookie Settings section.
  4. Uncheck the Use System Value box
  5. Set the desired value in the Cookie Lifetime field
  6.  Click Save Config
  7. Now adjust the admin lifetime. Go to  Stores->Configuration->Advanced->Admin
  8. Expand the Security section.
  9. Uncheck the Use System Value box
  10. Enter the desired value in the Admin Session Lifetime field
  11.  Click Save Config
  12. Clean the Magento 2 caches and your local browser cache to see the changes.
Updated on July 27, 2017

Was this article helpful?

Related Articles