Techumber
Home Blog Work

Magento Login issue with localhost(fixed)

Published on December 11, 2012

Hi guys how are you doing. First of all Sorry for this delayed post. In the previous post Create Online Stores Using Magento(Install guide) we have learn how to install magento in localhost. When next day I try to login it not letting me login (or) showing me any error message. But previous day I got logged-in. I took a screen shot of admin also(You can see it in previous post).

Then I went through all my previous web history then I figured out that actually I used //127.0.0.1 not //localhost/. When i searched for this issues in Google, I found may people are facing same problem. It is actually a problem in magento itself(not that big one). If you are facing the login issue at locolhost then try these methods.

1)Replace //localhost/ with //127.0.0.1/ 2)Disable your firewall/Antivirous. 3)This is the final step i should work anyone. Go to app/code/core/Mage/Core/Model/Session/Abstract/varien.php you will see 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();
}

Now comment this code. Most of IDE uses (ctrl+/) for commenting.(I am using netbeans PHP IDE) so the code looks like this.

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

This it! It should work like charm.