Feb 17, 2010
admin

Can’t login into admin panel of Magento (Problem and Solution)

Hello Friends !!

Yesterday, when I was starting to work on Magento E-commerce. When I was access Magento after installation, I can’t logged in Admin section.

After long time serching and research in Magento, finally I found the solution and currently I am able to login to admin section. Today I explain you about the problem and the solution.

First of all, what is Magento ?

Magento is one of the Opensource for E-commerce Websites. Its a top level opensource in E-commerce category.

Now time to explain the problem and the solution of the problem.

Problem

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.
Click Here for more details :
Everytime you do this you can’t log in to admin panel.

Reason of the problem

Do you know why this problem occures ? 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.

Now the time comes for solutions. There are two solutions for this problem which are shown below :

Solutions

First Solution
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 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.

Second Solution

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

and replace with

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

After this save the file. And try to login into the admin.

I think it will work now.

If you like this post or if you have any query or question then feel free to comment.

Hello Friends !!

Yesterday, when I was starting to work on Magento E-commerce. When I was access Magento after installation, I can’t logged in Admin section.

After long time serching and research in Magento, finally I found the solution and currently I am able to login to admin section. Today I explain you about the problem and the solution.

First of all, what is Magento ?

Magento is one of the Opensource for E-commerce Websites. Its a top level opensource in E-commerce category.

Now time to explain the problem and the solution of the problem.

Problem

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.

Reason of the problem

Do you know why this problem occures ? 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.

Now the time comes for solutions. There are two solutions for this problem which are shown below :

Solutions

First Solution

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 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.

Second Solution

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

and replace with

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

After this save the file. And try to login into the admin.

I think it will work now.

If you like this post or if you have any query or question then feel free to comment.

  • http://www.9gweb.com Joomla Development India

    thanks for providing this dude

  • http://www.expertmagentodevelopers.com Expertmagentodevelopers

    this article helped me alot.

  • Rakesh Nellai

    Thanks,,,   

  • Chary

    second solution worked for me perfectly……….
    thanks.

  • http://www.facebook.com/MaxQDesigns.Simon Simon Bérubé

    This has changed very slightly for 1.6.1, but this solution helped me regain access. Don’t forget to turn these settings back on after you’ve regained access! Thanks for sharing …

  • Mohd Rasihd

    I was so frustrated…to logged into Admin…Really its nice stuffs to Logged in using localhost domain..

  • bajolagua

    Works even in 1.6.1.0 but the code it´s a little diferent. Looks like this:

    // session cookie params
            $cookieParams = array(
                ‘lifetime’ => $cookie->getLifetime(),
                ‘path’     => $cookie->getPath(),

                //’domain’   => $cookie->getConfigDomain(),
                //’secure’   => $cookie->isSecure(),
                //’httponly’ => $cookie->getHttponly()
            );
    // ALL edit but first are mine
            // if (!$cookieParams['httponly']) {
            //    unset($cookieParams['httponly']);
            //    if (!$cookieParams['secure']) {
             //       unset($cookieParams['secure']);
            //        if (!$cookieParams['domain']) {
            //            unset($cookieParams['domain']);
            //        }
            //    }
            // }

    I´m working in localhost, i don´t know what happend when production, but actually it works.
    Thanks.

  • Pushpendra

    Thanks for the help, i was also facing this issue and was unable to login into back-end.

    Pushpendra

  • http://www.facebook.com/people/Adam-Kochanowicz/63203497 Adam Kochanowicz

    Before you try this, I would first attempt to fix by changing the following

    1. Go to backend
    2. System>Configuration
    3. Under “General,” Select “Web”
    4. In the accordion menu, expand “Session Cookie Management”
    5. Set “Use HTTP Only” to no.

  • Igz Dwd 27

     but i does’t work for me :(

  • Ali Lamine

    I tried but unfortunately it doesn’t work for me. Can you help me please, 

  • Sadrem

    Thank You very much

  • Mohit Wadhawan

    thanks……. for the reason u gave …. :)

  • Ivan Govno

    Thanks! it working in Chrome now 

  • Sachin06109

    http://192.168.1.19/magento/index.php/admin/dashboard/index/key/7aee52da1f559870ca19f5d786ded170/…..is there any other changes for 1.6.2.0…i have done all things u had said…but all is in vain…please give me another solution..

  • Hiten Mehta

    Man…you are a genious…i tried so many different things that i read on so many diff post…nothing was working…but this one did….thanks a lot

  • Romi-Ghrix

     its worked for me
    Thanks !!!

  • Akshaydaxini

    First solution worked for me thanks!!
    Akshay.

  • http://psdtomagento.com/ psd to magento

    we are having another problem after migration from one host to another. We can create admin user but new user can not login to admin. any idea what is the reason?

  • Adeel_iqbal786

    Bro ur awesome :D  

  • Anonymous

    great solution. Thanks a lot :)

  • Edy

    Thank second solution is worked for me.
    But If I copy to server from localhost. Do I need to remove comment symbol from above 3 parameters?

  • HImanshu

    Its worked  for me
    Thanks
    Himanshu Srivastava

  • Dfg

    thanks.

  • http://www.facebook.com/sanjaybisht21 Sanjay Bisht

    Thanks It works for me too

  • http://www.facebook.com/joelDSN Joel Jershan

    Thank You ….. its works now…. :)

  • Ayozebarrera

    Thanks, this one solved my problem. Good work

  • http://www.cherryrahtu.com/ Cherry Rahtu

    It works for Magento 1.7 too! Thank YOU !!!!

  • Anthony Lavin

    Another simple solution is to create a virtual host for the local magento.

  • Skybear_ok

    Very good…
    your first method is good…

  • Tim

    You are dear old chap. this worked me for when having login issue chrome.
    Thank you ja.

  • Franklin Antony

    But how would you Login into the Backend ?

  • Pit

    Another way to come around this is to start the browser-based installation/configuration NOT with “localhost/” but with 
    http://127.0.0.1/ in the url

  • AnchoredAnthony

    which works for 1.7? I’ve tried three different suggestions from this page, and none have worked.

  • AMIT KALPANDE

    Gr8 thx

  • Manthan

    Great Post man !!
    Thank You Very much…

  • Siddesh

    Great Post man !!Thank You Very much…

  • Amolakh10

     how it works 1.6 and 1.7 please give me proper thing

  • http://www.facebook.com/harshil31 Harshil Shah

    thank you solve with easy step ..really great

  • http://www.facebook.com/vinay.sachan Vinay Sachan

    Thank You dude :-)

  • Shubhra

    great work… thanks a lot.. !!

  • Gowri

    Thank you very much. its really Grate… Its working good

  • Marius

    Thank you, it works

  • jeet

    thanks adam..

  • shanker

    Thanks Alot Man.. Its work for me.

  • Darshan

    thanks dude really helped a lot

  • http://www.facebook.com/bharris007 Bryan Harris

    Lifesaver! Thank you!

  • Costa

    This was very helpful solved my problem thanks

  • Smash Web Media

    Thank you. It works

  • oussama

    thank you thank you :) :)

Support to grow

If you think my post is helps you then please make donation and do support to grow:

PHP Genious Services

I am a PHP freelancer india, PHP Developer india, PHP programmer india, Wordpress Freelancer india, Wordpress customization services, Wordpress Plugin Developer, Wordpress theme customization, Wordpress plugin customization, Magento Freelancer, Magento Developer india, Magento customization services, Magento theme integration, Opencart Developer india, Zencart Freelancer, Opencart customization, Opencart plugin development, HTML and CSS customization, cakePHP Developer, cakePHP Freelancer india, Ecommerce Developer india

Click Here for

Follow me on Facebook

Categories

Get Adobe Flash player