Session lifetime in magento2 frontend?

by user78358   Last Updated September 17, 2019 11:09 AM

What is the maximum session life time for the frontend customers in magento2?

Also, Is the session lifetime depends on session.gc_maxlifetime php variable?

Any help please?



Answers 1


The lifetime of a customer shopping session is determined by several factors, including the length of the server session, the use of a persistent cart, and the lifetime of information that is stored in the browser. Although these are related to the same customer experience, they are actually separate processes with different expiration events and lifetimes.

To configure the cookie lifetime:

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. If you have multiple stores, set the Store View chooser in the upper-right corner to the store where the configuration applies.

  3. In the panel on the left under General, choose Web.

  4. Expand the Default Cookie Settings section.

  5. To change the default, clear the Use system value checkbox and enter the new value in seconds.

  6. Click Save Config.

Reference URL: https://docs.magento.com/m2/ce/user_guide/customers/customer-online-options.html

Edit:

After setting your cookie lifetime in the admin to for example 1200 (in seconds, remember), check your php.ini settings to make sure session.gc_maxlifetime is set to something on the high end of what you may want to set in Magento (or on other applications on the same server).

86400 (one day) is a reasonable setting.

Sumit
Sumit
September 17, 2019 10:48 AM

Related Questions


Updated July 25, 2017 06:09 AM

Updated March 13, 2017 08:09 AM

Updated May 02, 2015 21:04 PM

Updated January 07, 2017 08:03 AM

Updated May 27, 2015 02:04 AM