Problem:
– I did a new installation of Magento 2.2.5.
– While installing it, I had disabled the third party modules installation.
– The installation was successful.
– Frontend opens fine.
– Backend opens fine.
– However, when I try to login to backend admin with the correct username and password, I get the following error:Your current session has been expired.
Cause:
It was because of a missing entry of “session lifetime” in the database table core_config_data.
You can login to your Magento2 database and check for the path admin/security/session_lifetime in core_config_data table.
OR, you can also check the configuration settings value via command line with the following command:
php bin/magento config:show admin/security/session_lifetime
If there is an entry with the path admin/security/session_lifetime in the core_config_data table then the output will be the value of that path.
If there is no any entry with the path admin/security/session_lifetime in the core_config_data table then the output will be the following error message:
Configuration for path: "admin/security/session_lifetime" doesn't exist
Solution:
I added the “session lifetime” entry in the core_config_data table and then refreshed the Magento cache from the terminal and then I was able to login to admin.
What you have to do is, add the path admin/security/session_lifetime with value 86400 in the core_config_data table of your Magento2 database.
INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`)
VALUES ('default', 0, 'admin/security/session_lifetime', '86400');
If you already have an entry in core_config_data table with path admin/security/session_lifetime then just try to increase the value of it to 86400.
UPDATE `core_config_data`
SET `value` = 86400
WHERE `path` = 'admin/security/session_lifetime';
OR, you can also directly set/update the configuration settings value via command line:
php bin/magento config:set admin/security/session_lifetime 86400
Refresh Magento Cache
– Open terminal
– Go to your magento installation root directory
cd /path/to/your/magento/folder
– Run the command to refresh cache
php bin/magento cache:clean
Hope this helps. Thanks.