Extend the Magento 2 Admin Session Timeout

Between your PHP configuration and your Magento configuration it can sometimes be frustrating to get your admin session timeout extended to prevent the login prompt from coming up every 15 minutes or worse losing your work.

Here’s a full proof method of extending your admin session timeout on Magento 2.

Step 1: Open your app/etc/env.php file for editing.

Step 2: Locate the session section. It should look like the following:

‘session’ => [
‘save’ => ‘files’,

Step 3: Add the path to your var/session directory. Now your session section should look as follows:

‘session’ => [
‘save’ => ‘files’,
‘save_path’ => ‘/home/<username>/public_html/var/session’

Step 4: Set your admin session timeout under Admin->Configuration->Advanced->Admin to your desired timeout:

Magento Admin Session Lifetime

Now you’re timeout should be lengthened. If you’re still having issues and the timeout remains the same you may want to try the following settings in your php.ini configuration however I wouldn’t recommend extending your default session timeout for the entire site for too long because that can cause a lot of session files in var/session which can build up and cause problems if it’s a high usage site.

session.gc_maxlifetime = 1440 (set this to your desired timeout)
session.cookie_lifetime = 1440 (set this to your desired timeout)
session.gc_divisor = 100
session.gc_probability = 1

StackExchange – Magento 2.2.6 Admin Session Timeout Not Working
eCommerce Developers – https://www.vectorns.com/magento-ecommerce-development/