voodish logo
tweet rss book of faces Linked In

Magento cookie problem [fixed]

There can be quite a few reasons why Magento issues the “enable cookies” page, it is usually a slight server misconfiguration, but can sometimes be down to a caching system or incorrect admin settings. Firefox seems to be untainted by this problem and troopers on regardless. IE, Opera and Chrome however, seem to have issues.

As there are many ways this problem can present itself, I think it’s a good idea to run through what worked for us, and then other possible solutions if that doesn’t fix it for you.

1. Synchronize the system clock

These instructions are for CentOS 5.*; how to install and configure NTP under CentOS Linux 5 server to synchronize the system clock.

Login as the root user

Type the following command to install ntp

# yum install ntp

Turn on service

# chkconfig ntpd on

Synchronize the system clock with 0.pool.ntp.org server:

# ntpdate pool.ntp.org

Start the NTP:

# /etc/init.d/ntpd start

Now check whether this has solved the cookie problem…
If not, let’s keep trying with the following:

OR…

2. Change cookie lifetime

Go to: Admin Panel -> System -> Configuration -> General-> Web-> Session Cookie Management and change COOKIE LIFETIME to 5400
(5400 seconds=90 minutes)

OR…

3. Remove Cookie params

Quite a drastic measure, so make sure to comment out, rather than delete:
Go to: Magento Folder/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php

and comment out the following that starts at about line 78 as you see below.

/*
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);
*/

I hoped that has helped you solve the Magento cookie problem, please leave a note to let us know how you get on. :)

Related Articles

Comments RSS Feed

1 Trackbacks/Pingbacks

  1. Pingback: Magento cookie problem [fixed], Voodish Articles. | Magento News on May 4, 2010

15 Comments

  1. innovative info solutions October 26, 2010

    Thanks
    Searching about same issue for some days now.

  2. Go to Top of the page

  3. steward December 29, 2010

    Awesome thank you.
    This was an occasional hassle in 1.3, but once we upgraded to 1.4.2 it was a show-stopper. The NTP thing worked perfectly and I would never have dreamed up that. I owe you guys a doughnut.

  4. Go to Top of the page

  5. flguy February 28, 2011

    It worked for me slightly different: setting the COOKIE LIFETIME to 0 - zero and commenting out the Cookie Params. Thank so much for you help.

  6. Go to Top of the page

  7. Irwan May 17, 2011

    Thank you very much for your help. It (almost) saves my life!

  8. Go to Top of the page

  9. Tibi July 20, 2011

    Well, after hours spent on this issue I managed to solve it but in my case the issue was that the development server hostname that we were using had an underscore character in it (e.g. my_hostname.com). It seems it’s a well known fact that IE can’t store cookies if the hostname has underscore characters in it.

  10. Go to Top of the page

  11. Sean August 21, 2011

    @Tibi
    Heh, for once Microsoft followed a standard to the letter and it tripped you up.

  12. Go to Top of the page

  13. Vdub August 23, 2011

    Magento 1.5.1.0 & Chrome cookie issue. Solved by using the 2nd solution, change cookie lifetime to 5400

  14. Go to Top of the page

  15. harris November 22, 2011

    i use the 2nd solution, set it to 20 years. but the problem still exist. It normal happened to 1st register customer. After logout and try to login again, it will redirect back to login page without any errors…

  16. Go to Top of the page

  17. Alex December 27, 2011

    thank you, I somehow changed my frontend admin Cookie Lifetime to 1, therefore not allowing me to edit anything in backend without having to log back in. This fixed my problem, cheers!

  18. Go to Top of the page

  19. Chris March 13, 2012

    Solution #3 is a real lifesafer!
    Thanks a lot!

  20. Go to Top of the page

  21. Dirk April 24, 2012

    thank god, you saved my live! I’d never have thought a time diff would be the issue

  22. Go to Top of the page

  23. Jo May 9, 2012

    Thanks mate!

  24. Go to Top of the page

  25. Vipul August 30, 2012

    Awesome…!!!
    Option #3 worked for me.

    Thanks a lot…!!!

  26. Go to Top of the page

  27. ZAky October 25, 2012

    magento comunity 1.7.0.2
    Comment the line

    call_user_func_array(’session_set_cookie_params’, $cookieParams);
    Line 108~

    in file app/code/core/Mage/Core/Model/Session/Abstract/Varien.php

  28. Go to Top of the page

  29. sourav February 28, 2014

    thanks for your post..it really worked for me… thanks a lot :) :) :)

  30. Go to Top of the page

Leave a comment