Something is wrong with the admin session timeout in Magento2.2.6. I have everything set to 1 day however it's all ignored. I get logged out if I'm inactive for 15 minutes. I have vendor/magento/module-encryption-key/etc/config.xml set to 86400 and here are screenshots of my PHP and admin settings and my cookie which shows an expiration date of tomorrow but I will have to login again despite everything appearing to be setup correctly, what else am I missing?

Admin session timeout

PHP Settings

Cookie Shows Tommorrow


You should also try it by changing the following PHP INI varibles:

session.gc_divisor = 100
session.gc_probability = 1

For more details check: http://php.net/manual/en/session.configuration.php#ini.session.gc-divisor


@MageAj your answer got me in the right direction. It wasn't the actual solution but it led me to the problem. Once I set gc_divisor and gc_probability I found that Magento was unable to write to the php default session path which was set to the following:

session.save_path = "/var/cpanel/php/sessions/ea-php70"

So I edited env.php and added save_path to the session section as follows:

'session' => [
        'save' => 'files',
        'save_path' => '/home/<user>/<magento_dir>/var/session'

Another solution might be to change from files to db for session storage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.