Thursday, October 11, 2012

Can not login to magento admin and frontend

Im using centos. I had a problem, Magento frontend and admin login doesn’t work and loops back to login with no message. This happens because of session cookie problem. I solved this problem by installing ntp

In your shell type the below command to install ntp

    # yum install ntp

Turn on ntp service

    # chkconfig ntpd on

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

    # ntpdate pool.ntp.org

Start the NTP service:

    # /etc/init.d/ntpd start
 
Now check whether this has solved the cookie problem. If not try the following. comment the below lines in "/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php".

if (!$cookieParams['httponly']) {
 unset($cookieParams['httponly']);
 if (!$cookieParams['secure']) {
  unset($cookieParams['secure']);
  if (!$cookieParams['domain']) {
   unset($cookieParams['domain']);
  }
 }
}

if (isset($cookieParams['domain'])) {
 $cookieParams['domain'] = $cookie->getDomain();
}