Magento 2 Admin Session Lifetime

In Magento by default, the Admin is initially set to time out after 900 seconds, 15 minutes of inactivity.

This may cause a problem that you have to login many times. In this tutorial, we will show you how to adjust the lifetime of the admin session to fit your work style.

What we have to do:

  • Change setting in backend
  • Check and edit PHP environment variables

1. Change session life time in backend configuration

On the Admin sidebar, choose Stores -> Settings -> Configuration

In the panel on the left under Advanced, choose Admin

Expand Security  then go to field Admin Session Lifetime (seconds)

Set the new lifetime in second, example 1 day = 86400 then click on save configuration

Magento 2 Admin session by Metagento

2. Check/Edit PHP environment variables

After setting the new lifetime in Magento backend, we need to make sure that your server allows to use this value.

Create php.ini file in your Magento root directory ( if it already exist, skip this step )

Add following lines to the file then save it:


php_value session.cookie_lifetime 86400

php_value session.gc_maxlifetime 86400


3. Clear Magento cache, logout current session and login again


That’s how to change the admin session lifetime on Magento. You can use another value to make it work as you want.

If you have any question or need assistance, leave us a message.

Magento 2 Admin Session Lifetime
5 (100%) 1 vote

Written By Metagento

Leave a Reply

Your email address will not be published.