Wednesday, March 7, 2012

Magento After Installation Admin Doesn't Login

If you want to install Magento on WAMP orXAMPP server, localhost, then you are going to face a very irritating problem with it, which does not let you go into the admin panel, even if you enter the correct details.
So, here is the simple fix to override this problem.



This is for Magento v1.3.2.4 :
Open this file,
app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
and find the     session_set_cookie_params(line-78) and replace your code with this ;
 session_set_cookie_params(
 $this->getCookie()->getLifetime(),
 $this->getCookie()->getPath()
 //$this->getCookie()->getDomain(),
 //$this->getCookie()->isSecure(),
 //$this->getCookie()->getHttponly()

This is for Magento v1.4.0.1 :
Open up Varien.php at app/code/core/Mage/Core/Model/Session/Abstract/Varien.php and find the following snippet starting at line 77:
// session cookie params
        $cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath(),
            'domain'   => $cookie->getConfigDomain(),
            'secure'   => $cookie->isSecure(),
            'httponly' => $cookie->getHttponly()
        );

        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();
        }
Now comment out the relevant parts like so:
  // session cookie params
        $cookieParams = array(
            'lifetime' => $cookie->getLifetime(),
            'path'     => $cookie->getPath(),
            'domain'   => $cookie->getConfigDomain(),
            'secure'   => $cookie->isSecure(),
            'httponly' => $cookie->getHttponly()
        );

       /* 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();
        }*/

For Magento 1.5.x and Above :
Just comment out the code and make it look like :
  /* 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();
  } */

No comments:

Post a Comment

Thankyou for your Comments

LinkWithin

Blog has moved, searching new blog...