简体   繁体   中英

Why is magento sometime shows a blank page and sometime redirects to same admin login page after admin login?

I am using magento 1.8.1.0. While transferring magento from local server to live server, I could not log-in to admin dashboard. Sometime it shows blank page and sometime it redirects to same admin log-in page.

I googled a lot about this issue and tried all possible solution i found like following:

  1. commenting out some elements of $configParams array in Varien.php
  2. In database table core_config_data, i changed "web/unsecure/base_url" and "web/secure/base_url/" to " http://example.com/ ", changed "web/cookie/cookie_path" to "/" and "web/cookie/cookie_domain" to ".example.com"
  3. Edited "app/etc/local.xml" file and kept correct mysql hostname, username, password, and database name
  4. Cleared "var/cache" and "var/session" folder
  5. Changed file permission to 775 to avoid any permission error

After applying all these errors, the problem is still not resolved. Log-in to admin still shows blank page or redirects to same page. I think it's the issue of session cookie. I desperately need help in this. Please i beg someone to solve this issue. Thank you in advance.

I solved the issue. However, i saw many magento beginners struggle in their first attempt of moving magento from localhost to live server and there is no one place solution for this. Here, i tried to make this post a one place solution for this issue with a useful links that i referred and some other steps so that you guys don't have to google much.

  1. chapagain's blog for step by step guide to move magento from one server to another

Apart from the steps mentioned in this blog, you must do some more steps in order to make it work.

  1. In database table "core_config_data" change "web/cookie/cookie_path" to "/"
  2. Again, change "web/cookie/cookie_domain" to ".yourdomain.com"
  3. comment out some line of code in "app/code/core/Mage/Core/Model/Session/Abstract/Varien.php" shown as below

    In magento 1.8.1.0, it is in line 88 to 94.

      $cookieParams = array( 'lifetime' => $cookie->getLifetime(), 'path' => $cookie->getPath()/*, 'domain' => $cookie->getConfigDomain(), 'secure' => $cookie->isSecure(), 'httponly' => $cookie->getHttponly() */ ); 

This should solve the issues in moving magento from localhost to live server. But, if you are still having problem to log-in as admin like i had then check your log file. In my case, i had to install "PHP curl library".

I hope this will help others.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM