Home » Magento » Magento can’t login admin panel after installed

Magento can’t login admin panel after installed

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,

to

3-Comment the below mentioned code(line number 86).

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.

Tags

Similar posts

  • Johnnyipp

    Here is my code I am using 1.7 I cannot login to the backend, I have tried several options with not luck any advice would be great

     // 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’]);
                    }
                }
            }
           if (isset($cookieParams[‘domain’])) {
        $cookieParams[‘domain’] = $cookie->getDomain();
    }
             

            call_user_func_array(‘session_set_cookie_params’, $cookieParams);

            if (!empty($sessionName)) {
                $this->setSessionName($sessionName); 

  •  In the Magento 1.7.0
    open the varien.php file and go to the line 85.That is like this;
    // session cookie params
            $cookieParams = array(
                ‘lifetime’ => $cookie->getLifetime(),
                ‘path’     => $cookie->getPath(),
                ‘domain’   => $cookie->getConfigDomain(),
                ‘secure’   => $cookie->isSecure(),
                ‘httponly’ => $cookie->getHttponly()
            );

    Remove these lines.
    ‘domain’   => $cookie->getConfigDomain(),
                ‘secure’   => $cookie->isSecure(),
                ‘httponly’ => $cookie->getHttponly()

    After removing  like this,

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

    ——————————————————————

    Remove/comment following code.(line 94-106)
            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();
            }

    Thats only.
    View the image after I added to the post.
    Thanks

    • Johnnyipp

       Hey Sumith,

      I  did the first part and removed what you said to do but can you explain the second part and show how ro remove/comment following code–i dont even know what a comment is  Thanks 
      __________________________________________________
      Remove/comment following code.(line 94-106)        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();        }
       

    • Johnnyipp

       Hey Sumith

      I did the 2 parts you said to do here is the code from my site so you can see it, still not working, can you look and see
      what I am missing,  I do not understand your 3rd statement about the database can you walk it through, thank you very very much

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

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

              call_user_func_array(‘session_set_cookie_params’, $cookieParams);
       

      •  
        First you must check your site access url is localhost or 127.0.0.1
        If you are using localhost, change it to 127.0.0.1
        Then you can access your site like http://127.0.0.1/magento_site

        If you are using 127.0.0.1, change it to localhost.
        Then you can access your site like http://localhost/magento_site

        The  try to access to login.
        If not success try to do following solution.

        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

        See the attachments here.

        Thanks