I am facing weird problem with magento admin login process. After installing fresh magento on live server, whenever I login at admin side first time, it will not login though the username and password are correct. Just after few seconds I will login with same username and password it will login successfully. I have searched a lot on net regarding the same. But I couldn’t get rid of this. Any help from you guys will appreciate.
-
3Are the url's you use for log in the same? I mean maybe one is www.mysite.com/admin and the other is mysite.com/admin (without www).– Marius ♦Commented Jul 29, 2013 at 15:03
-
Just in addition to my answer. My site was initially like that. After a couple of tries you could log in. Weird. I thought I'd fixed it by setting the cookie domain explicitly, but evidently not. I want a proper answer as much as you! :)– McNabCommented Jul 29, 2013 at 22:41
-
One more thing - some of the ideas in my answer would only apply to a site where you couldn't log in at all. Like I say though, this site of mine was intermittent like yours at first and then it couldn't be logged into at all by anyone.– McNabCommented Jul 29, 2013 at 22:46
-
Thank you so much Marius. Your solution really worked for me.– Milople IncCommented Jul 30, 2013 at 4:51
-
1@Marius, please post your comment as an answer so OP can accept it.– Tim BezhashvylyCommented Jul 31, 2013 at 21:24
2 Answers
Are the url's you use for log in the same? I mean maybe one is www.mysite.com/admin
and the other is mysite.com/admin
(without www)
Initial this was a comment, but I add it as an answer as @Tim suggested
Been on this tonight myself, I empathise. Basically there are a few things to check. As it's a live server I imagine you do not have the classic gotcha of the localhost
problem, and the domain is a proper domain.
First of all, here is a good StackOverflow Q&A with advice from Alan Storm about your server config, timezones, ini settings, PHP write permissions. It could be that,
https://stackoverflow.com/questions/9075539/cant-login-to-magento-admin
Ashley Schroeder ended up building a wiki on it here;
http://www.aschroder.com/2009/05/fixing-magento-login-problem-after-a-fresh-installation/
And there is some more good stuff from gabrielk in this thread;
http://www.magentocommerce.com/boards/viewthread/33778/
None of this worked for me, and I had a client who couldn't access his orders (mine isn't a new site, it's been up for about 6 months!) so I had to sort it fast. To my irritation I have had to resort to the 'fix' (read nasty core hack) of modifying Varien.php by copying this file to local;
app\code\core\Mage\Core\Model\Session\Abstract\Varien.php
And commenting out the following (it's lines 85 to 102);
// 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']);
// }
// }
//}
I do not want to leave it this way obviously, so if you find a fix which isn't mentioned above, post it here. Incidentally mine is on a AWS server with a bitnami image which I am convinced has been misconfigured somewhere.
-
My problem seemed to like of not matching the server domains with cookies as Marius mentioned in his comment. So I have resolved it by removing the www from my admin login url. Commented Jul 30, 2013 at 7:37
-
Glad you got it sorted! I'm going to leave my answer anyway as I turned up tons and tons of rubbish while googling, and these were the best resources :)– McNabCommented Jul 30, 2013 at 11:50