Home » Magento7 July 2009

Magento Admin login problem

Problem:

I had a new installation of magento. But I was unable to login as an administrator. I went

to the admin login page, entered correct username and password but was redirected to the

same login page. I could not enter the dashboard page. Error message is displayed when I

enter wrong username or password. But nothing is displayed and I am redirected to the same

login page when I insert correct username and password.

Solution:

I googled and found these solutions:-

1) Use 127.0.0.1 instead of localhost in your url, i.e. using

http://127.0.0.1/magento/index.php/admin instead of
http://localhost/magento/index.php/admin . But this didn’t solve my problem.

2) Since I am using Windows XP, I was suggested to open “host” file from
C:\WINDOWS\system32\drivers\etc and have 127.0.0.1 point to something like magento.localhost

or even 127.0.0.1 point to http://www.localhost.com . But this also didn’t work either.

3) This solution finally helped me out of this problem. The solution was to modify the core

Magento code. Open

app/code/core/Mage/Core/Model/Session/Abstract/Varien.php. Comment out the

lines 80 to 83. The line number may vary according to the Magento version. These lines

are present somewhere near line 80. You have to comment the comma (,) in line: $this-

>getCookie()->getPath()//,

NOTE: Editing Core File is NOT a good practice. It is better to make a local copy of core file. Copy app/code/core/Mage/Core/Model/Session/Abstract/Varien.php to app/code/local/Mage/Core/Model/Session/Abstract/Varien.php and edit it.

// set session cookie params
session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()//,
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

Well, I am out of this problem. Hope, this solution you also help you.

Update (For Magento 1.4.*)

In Magento 1.4, you have to comment code from line 86 to 98 in

app/code/core/Mage/Core/Model/Session/Abstract/Varien.php.

NOTE: Editing Core File is NOT a good practice. It is better to make a local copy of core file. Copy app/code/core/Mage/Core/Model/Session/Abstract/Varien.php to app/code/local/Mage/Core/Model/Session/Abstract/Varien.php and edit it.

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

From Mukesh Chapagain's Blog, post Magento Admin login problem

php magento mukesh chapagain

Get New Post by Email

Find me on

Facebook Twitter Google+ LinkedIn RSS Feed
  • Pingback: Magento Admin / Customer login problem | Repository

  • Manish Chauhan

     * I will want a way to flag an order as Sales Receipt or Invoice in Magento anyways so we can use that as a guide when we run a sync in T-Hub.Can this be made to show a color flag specific to Sales Receipt and a different color for Invoices in the Orders listing page in Magento?
        * Is there anything that can be shown visually to indicate in Magento that the order has already been synced to QB? Could this also be shown on the Magento Order listing page?

    can i get it in magento??

  • Numan_tahir1

    yaa nice work its working…. :)

  • http://twitter.com/aftabnaveed Aftab Naveed

    You Rock man!

  • Komal Web

    I have installed a copy magento in ubuntu which was working fine on windows.
    Not m facing a problem that which typing the admin url it is not displaying any login window. Frontend is working find. also I have checked rewrite module and curl. 
    Do you have any idea why the application is not working on ubuntu platform only for admin area.
    Also it is not displaying any error in log.

  • petrus

    cool

  • Jit

    Update (For Magento 1.5.*)
    // session cookie params
            $cookieParams = array(
                ‘lifetime’ => $cookie->getLifetime(),
                ‘path’     => $cookie->getPath()//,
                //’domain’   => $cookie->getConfigDomain(),
                //’secure’   => $cookie->isSecure(),
                //’httponly’ => $cookie->getHttponly()
            );

  • Hervé

    Also works with 1.6.
    Do not forget to comment line 104 :

    //call_user_func_array(‘session_set_cookie_params’, $cookieParams);

  • Nomonicker

    After searching the Web and trying various solutions this one finally worked!  Thanks for posting it!

  • Obreio

    thanks it works for me

  • Andy

    Editing the core file is not a good practice. Try duplicating the Varien.php with the folder structure in your local folder. This way it will not be affected when upgrading Magento versions.
    Cheers

  • Webdesigner9247

    you have saved my time thanks its working fine thanks

  • http://premiergoalandhighlight.blogspot.com/ wantknow

    Thank you, method 3 help me !!

  • Pingback: Magento site live vers site en local : le parcours du combattant « Creation de site Internet Inattendus (Les). 24H du Mans. Course. Agence de communication, evenementielle, hotesses, travaux, design, accueil, e commerce, impression, streetmarketing.

  • thankyou

    thanks it worked for me

  • mmbala

    Thanks Now I got my admin panel nice post

  • Ram

    Thanks Mukesh.

  • pivr

    bravo care

  • sopedro

    In my case the problema that the browser didn’t accept the magento cookies it’s all about clock settings. My pc was configured to update Windows time automatically. uncheck this option and put the right date and test again. Now the cookies are stored because de datetime it’s the same. Hope this helps…..

  • ds

    very thanks to you :)

  • Pingback: Magento安装完成后,后台不能登录 | Phnix

  • Glaux

    I use Magento 1.7 and after commenting out the comma I get the error: Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘)’ in /home/mysite/public_html/app/code/local/Mage/Core/Model/Session/Abstract/Varien.php on line 89

  • Glaux

    Sorry my bad, didn’t realize you meant “from Magento 1.4 onwards” follow the updated instructions. Works now.

  • Sheyo

    it works fine. thanks

  • Jithin Lukose

    Thank you very much….

  • Lee

    Great Post. Led me in the right direction. I had to comment out lines 85 to 106 in Magento ver. 1.7.0.2 – I hope that does not mess anything up. Please comment if you think it will. Thanks in advance.

  • Pingback: Cannot login to Magento admin panel after installation | Dynamics AX

  • Kleeyo

    Ow thank you so much man.
    It was really a stupid thing, thanks to you it finally works on my localhost

  • niraj

    thanks for update, its solved my same issue

  • Nick Mc.

    Great article! One temp solution that helped me is by deleted only the local host site’s cookies and that helped too but is only temporary until it happens again. Your solution is more permanent but does change core code, even when overridden properly like you suggested.

  • http://dexteradams.me/ Dexter Adams

    Awesome! This worked for an install I was doing. Was racking my brain.

  • Mujahid

    Your the MAN, thanks dude … I started hating magento, I faced 5 problems installing it .. this problem was #5 i hope I don’t face #6

  • Navin Bista

    I know It works but do you think modifying the core magento file is a good option,should be other ways

  • alex

    Work like charm! Thanks dude! Btw I wonder why this Magento is hard even to install ?