Magento

Magento can’t login admin panel after installed

  • 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