Unable to log into the Admin Panel. After installation of new fresh magento.

Using localhost (WAMP, XAMP, AppServ etc)

magento-can't-login
magento-can’t-login

If you are running Magento on local server using the specific server applications (listed above) try to replace ‘localhost’ in the website URL with’127.0.0.1′. In other words link to the Magento admin panel login page will be ’127.0.0.1/magento/admin’

If this doesn’t help please proceed to other solutions

Edit Varien.php file

Open Magento installation directory and go to the ‘app/code/core/Mage/Core/Model/Session/Abstract’ folder. There open ‘Varien.php’ file with your editor (Adobe Dreamweaver, Notepad ++ etc).

Magento 1.4.x

Depending on your version of Magento the code can be different so I’ll show you several cases.

In the Varien.php file locate the code:

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

And comment it. Type /* before the code and */ after. Or just replace it with the code below:

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

Magento 1.5.x and Magento 1.6.x And Magento 1.7.x

In the Varien.php file locate the code:

$cookieParams = array(
    'lifetime' => $cookie->getLifetime(),
    'path'     => $cookie->getPath(),
    'domain'   => $cookie->getConfigDomain(),
    'secure'   => $cookie->isSecure(),
    'httponly' => $cookie->getHttponly()
);

and replace with

$cookieParams = array(
    'lifetime' => $cookie->getLifetime(),
    'path'     => $cookie->getPath(),
//  'domain'   => $cookie->getConfigDomain(),
//  'secure'   => $cookie->isSecure(),
//  'httponly' => $cookie->getHttponly()
);

The Another Way is better way for Magento.
Step 1 : When you installing magneto they ask for host name don’t write “localhost”.
Step 2 : you have to write 127.0.0.1 in place of “lcoalhost”
Step 3 : Now you can access your admin panel. Without change the varien.php file.

Advertisements

Leave your comments

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s