Home Featured, Headline, Magento eCommerce

After installing magento can't log in to admin panel

23 April 2009 32 Comments

Problem Description
While installing magento on xampp version 2.5 you have provided admin username and password. After installation finished you no longer login with your admin account. In fact in the “Log in to Admin Panel” window whenever you provide wrong password/username combination it displays “Invalid Username or Password.” But whenever you provide correct password it does not show anything. Though a new url like
http://127.0.0.1/magento/index.php/admin/index/index/key/d135be4de664ab83db829120740e058a/
is displayed on the address bar.
Everytime you do this you can”t log in to admin panel.

Cause of the problem
The problem occurs because magneto could not store cookies. We run it as localhost and localhost is not true domain but to store cookies we need a domain. That”s why login stops without saying any word.

Solution of the problem
Way 1:
In different forums I saw they mentioned connecting as http://localhost/magento/index.php/admin will fail but if you connect as http://127.0.0.1/magento/index.php/admin it will work. But in my case IP address in the URL did not work too.
I made it be Aanbevolen spellen online casino Aanbiedingen Bankzaken Help FAQ Als u nog nooit videopoker hebt gespeld, wordt di teen ware traktatie. work into whenever I changed my browser. Suppose I installed magento using google chrome browser and I open admin url into my firefox window and it worked. Though in the firefox the url http://localhost/magento/index.php/admin did not work, but url http://127.0.0.1/magento/index.php/admin worked fine.

Way 2:
-Go to app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file within your magento directory.

-Find the code,

session_set_cookie_params(
 $this->getCookie()->getLifetime(),
 $this->getCookie()->getPath(),
 $this->getCookie()->getDomain(),
 $this->getCookie()->isSecure(),
 $this->getCookie()->getHttponly()
 );

-Replace above code by,

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

-Save it and try to login to your magento admin panel.
It would work. :)

Related posts:

  1. Configuration error on new Magento installation
  2. PHP extension error while installing Magento
  3. Access denied in Magento admin
  4. Installing Magento easy way
  5. Disabling wishlist functionality

32 Comments »

  • admin (author) said:

    hello

  • johny said:

    the only solution that works
    10q
    if u only comment the lines instead of replacing text take a good look at commas

  • Joguy said:

    Hello,

    The second way works perfectly.
    The server is windows server 2003 and Xampp.

    Thanks you.

  • damith said:

    hey thankx
    way – 1 st is work for me.
    i log into admin pannel with IE using loopback address

    thankx

  • Alex V. said:

    Thanks! This was very helpful.

  • Janki said:

    Hey Thanx.
    It’s work.

  • Ta Cuong said:

    Thank you for topic.

  • phunk said:

    Solution 2 is right. There’s only one piece of code block to temporarily disable in one of Magento’s Core files. Found this blog that tells the same remarkable solution. http://markuzweb.blogspot.com/2009/08/cant-login-to-magento-admin-panel-after.html

  • azerty said:

    Great !! many thanks

  • Ram said:

    Great help. Second method works perfectly.

  • Mittal Patel said:

    Thank you veryyyyyyyyyyyyyyyy much…
    You saved me from panic!!!

  • Saran said:

    Hi

    Thank you very much. Its working very nicely. After login using with ip address, base url warning is coming. If we are changing that value in configuration part, its working perfectly.

    thanks
    Saran

  • Rakesh said:

    Great work :) Thank you

  • neer said:

    hey thanx….it was really helpful…

  • N.Karnan said:

    It’s really a valuable post….!!thanks…(I enjoy the benefit of Ur post)!!!

  • Filipe said:

    Way 2 worked for me, thanks!

  • Saneesh K V said:

    Hi,
    Thank you very much!
    It works for me.

    Thanks again!
    San.

  • Manish said:

    Have seen these two solutions on lotsa blog… both didn’t work for me… :o (

    any othe solution pls ?

    rgs
    Manish

  • Abdur said:

    i get error

    Parse error: parse error in C:\wamp\www\magento\app\code\core\Mage\Core\Model\Session\Abstract\Varien.php on line 84

    any one can help me?

  • Dawod said:

    i have this code in app\code\core\Mage\Core\Model\Session\Abstract\Varien.php in this file

    $cookieParams = array(
    ‘lifetime’ => $cookie->getLifetime(),
    ‘path’ => $cookie->getPath(),
    ‘domain’ => $cookie->getConfigDomain(),
    ’secure’ => $cookie->isSecure(),
    ‘httponly’ => $cookie->getHttponly()
    );but when i comment 3 line then i got error given below

    http://localhost/magento/admin

    Error log record number: 1663895226

    can any one help me

  • kajal said:

    I worked all the solutions provided for this error
    I would suggest if none of the codes works for u than try this one
    it worked for me..
    None of the above..

    In fact, in version 1.4.0.1 you can comment only the line #100 ( call_user_func_array(’session_set_cookie_params’, $cookieParams); ) and it will work

  • admin (author) said:

    Hi,
    Note that when you comment 3 lines, you also need to removed character , on the line ‘path’ => $cookie->getPath(),
    This is really must be $cookieParams = array(
    ‘lifetime’ => $cookie->getLifetime(),
    ‘path’ => $cookie->getPath()
    //‘domain’ => $cookie->getConfigDomain(),
    //’secure’ => $cookie->isSecure(),
    //‘httponly’ => $cookie->getHttponly()
    );
    Hope that it works for you

  • Dawod said:

    Thanx to all my admin Panel is working now

  • ThinkClothingArt said:

    Thanks to Kajal above, commenting line 100 worked, that was an easy fix that only took a few hours to figure out. :) Thanks Varien for the great local install instructions on windows :)
    I will try Richard’s too which seems quite comprehensive, but for a quick fix Kajal worked.
    Now to figure out this pesky index.php url rewriting issue now that I can log in. Boy talk about out of the box turn key. Maybe they shoudl package up a developer local install instead of having to work all this out via forums.
    Cheers Guys.

  • jason said:

    @kajal was abt to give up then i saw ur post thankx a million , commenting out line #100 worked for me too ,

  • Vo Tan Tai said:

    I think you have to comment this this line

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

  • Jaso said:

    Hi there,

    I am using this simple procedure under Windows7:
    1. install XAMPP and enable \"iconv\"

    2. edit the file \"hosts\" to this: 127.0.0.1 localhost.com

    3. copy the magento files to the directory: C:\\xampp\\htdcs\\magento\\

    4. start the Apache and MySQL

    5. Go to the address: http://localhost.com/magento

    6. Follow the installation wizard.

    7. Now You will be able login to the administration.

    ENJOY!

    =D

  • Tapu said:

    Thank u so much….i like this. 2nd one is really helpful…:)

  • Lloyd said:

    Tahnak you so much it works…

    Lloyd

  • Magento Themes said:

    Its the fact……..Thanks for solving my problem.I was also facing this type of problem.It was a nightmare for me.Thanks a lot.

  • sasi kumar said:

    2nd method works like charm!!!

    Thank you so much..

    Cheers!