3

I'm having an issue with Magento CE version 1.9.0.1 with admin session timeouts. It goes like this:

  1. I log into the admin.
  2. I go to the Catalog page.
  3. I leave the window open, and after a while my session times out.
  4. Later, I come back to the open window, and click on link to manage categories.
  5. Because my session has timed out, I see the login screen. I put in my username and password and submit.
  6. The page refreshes and requires me to login again. I put in my username and password and submit.
  7. The second login works.

This is different from the infamous "can't log into the admin, page just refreshes" bug because it only requires two logins to work every time.

I think it might have something to do with an old key being left over in the URL on step 5, but I'm not sure. Any ideas?

Edit 1 To be clear, I am not looking to simply extend the lifetime of the session.

Edit 2 I should note that I have a different domain for the admin than I do the frontend. I can't find a way to set a different cookie domain for each.

3
  • Admin sessions that time out are a waste of time and incredibly frustrating. Save yourself the headache and adjust the timeout value to something sufficient. I use 86400 (1 day).
    – pspahn
    Commented Jan 6, 2015 at 21:24
  • 3
    If you have any dev environments, make sure you're setting the cookie domain to the FQDN so you won't log yourself out logging into dev in the same browser session.
    – B00MER
    Commented Jan 7, 2015 at 0:16
  • in lots of setups i dont even use cookie settings, keep em all empty, and it works :)
    – user2857
    Commented Jan 8, 2015 at 19:28

3 Answers 3

2

If you have any dev environments, make sure you're setting the cookie domain to the FQDN so you won't log yourself out logging into dev in the same browser session.

More Details:

1
  • 1
    For others that might find this in the future, pay careful attention to Default/Website/Store values for this if you have your adminhtml on a different domain (or subdomain) than your frontend.
    – Tyler V.
    Commented Jan 8, 2015 at 22:39
6

Yes, you need to update few setting to increase the session time in admin.

Go to=> System => Configuration => Admin => Security => set Session Lifetime (seconds) : value as you want. ( like : 14000).

Now go to

System => Configuration =>Web => Session Cookie Management => set Cookie Lifetime 14000.

Note : This would be effect after next login.

below is another Solution. It should produce the desired results according to the following code in: app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

if (Mage::app()->getStore()->isAdmin())
{

     $adminSessionLifetime = (int)Mage::getStoreConfig(’admin/security/session_cookie_lifetime’); 
       if ($adminSessionLifetime > 60) 
       { 
          Mage::getSingleton(’core/cookie’)->setLifetime($adminSessionLifetime); 
       }
}
3
  • My goal is not to extend the lifetime of the session, but to correct what happens when the session times out. Right now @b00mer's solution seems to be working for now.
    – Tyler V.
    Commented Jan 7, 2015 at 20:05
  • 3
    I changed this to like 2 weeks but it still logs me out after like 20 mins of inactivity (M2)
    – OZZIE
    Commented Sep 13, 2016 at 14:16
  • I have changed both "Cookie Lifetime" and "Session Lifetime" to value 259200 (3 days), but admin logs out in about 1 hour of inactivity. Looks like a bug?
    – dma_k
    Commented Feb 21, 2019 at 12:04
1

From Magento admin, go to:

Stores > Configuration > Advanced > Admin > Security > set the value to 31536000

In php.ini file, change the following:

session.cookie_lifetime 31536000
session.gc_maxlifetime 31536000
1
  • As to my observation, changing session.cookie_lifetime (as well as "Session Lifetime" in Magento configuration) is not necessary (it is 0 by default), but session.gc_maxlifetime really helped the issue. Thanks for the hint!
    – dma_k
    Commented Mar 8, 2019 at 14:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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