Skip to content Skip to sidebar Skip to footer
Reading Time: 2 minutes

If you are not installed magento previously this is a problem you faced.After installation magento returns a message that the installation was successful and you can proceed to the administration panel. Although providing the correct username / password, magento does not show anything. Providing wrong username / password , magento returns the message “Invalid Username or Password”.If you login from different browser same effect will happening.
The login attempt was made through the “localhost ” or ” 127.0.0.1? socket , but you can’t log in to admin panel.The problem occurs because magneto could not store cookies. Localhost and “127.0.0.1? are not true domains , and browsers allow only real domains to store cookies ,that’s why login stops without any indication.

If not success read the configurations of your server through phpinfo() file, is the module “mode_rewrite” loaded?

Solution-1

If you are using 127.0.0.1 change it into localhost.If you are using localhost change it into 127.0.0.1.
Then try to login.
Ex:
http://localhost/magento_site/
http://127.0.0.1/magento_site/

Solution-2

1-Go to following file and open it.I’m using is 1.4.0.1
app\code\core\Mage\Core\Model\Session\Abstract\varien.php

2-Search for “// session cookie params” line(77) .
Change,
Magento set, get and delete cookie data
$cookieParams = array(
‘lifetime’ => $cookie->getLifetime(),
‘path’ => $cookie->getPath(),
‘domain’ => $cookie->getConfigDomain(),
‘cookieParams’ => $cookie->isSecure(),
‘httponly’ => $cookie->getHttponly()
);

to
Magento set, get and delete cookie data
$cookieParams = array(
‘lifetime’ => $cookie->getLifetime(),
‘path’ => $cookie->getPath()
);

3-Comment the below mentioned code(line number 86).
Magento set, get and delete cookie data
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();
}

Final script like this.
Magento can’t login admin panel after installed

4-Now login as admin, it will work!

Solution-3

Go to the following folder and delete all folders in it.
/var/cache
/var/session
Try to log into the admin panel.

Solution-4

Go to the database and open “core_config_data” table and find the correct data is exist in the following records.
web/secure/base
web/unsecure/base
web/cookie/cookie_domain
web/cookie/cookie_path

That’s only.