tony09uk
tony09uk

Reputation: 2991

localhost to 127.0.0.1 as default

I am trying to use Magento on a localhost, but when I try and log in to the admin area the screen just refreshes.

In the address bar it was localhost/magento/.......(etc). When I changed it to 127.0.0.1/magento/.......(etc) it allowed me in. When I click on one of the buttons in the admin area it goes back to localhost/magento/......(etc) and I am once again faced with the login page.

How and where do I alter the setting the settings so the 127.0.0.1 is used as default rather than localhost.

Upvotes: 0

Views: 8548

Answers (4)

Martijn van Hoof
Martijn van Hoof

Reputation: 760

If you have database acces open table: core_config_data Do a search for: SELECT * FROM core_config_data WHERE path LIKE '%cookie%'

change: cookie_domain & cookie_path to = "" (empty string). Login once again to the admin panel. fixed!

Upvotes: 0

Luke Barker
Luke Barker

Reputation: 915

on OS X I found a simpler way - I am using MAMP running 127.0.0.1:8888, the default for MAMP installs.

  • Just set your /app/etc/config.xml line that says localhost to 127.0.0.1
  • delete var cache and session contents
  • clear cookies in browser

this now lets me login to the dashboard from the admin login screen.

Upvotes: 0

Mukesh
Mukesh

Reputation: 7778

If you want to change loaclhost to 12.0.0.1 do following.

If you have database access go to "*core_config_data*" table and there change "web/unsecure/base_url" and "web/secure/base_url" to 127.0.0.1 instead of localhost.

Otherwise you can use the solution provided by tony09uk.

Upvotes: 1

tony09uk
tony09uk

Reputation: 2991

Finally after seven hours of playing about with suggestions and re-installing I have fixed it, for those with the same problem i will share what I did.

I am using Magento 1.7.0.2. Apparently there is an issue regarding cookies when you install Magento on windows as it was designed for linux system. So you need to sort the cookie issue. To do this open your Magento folder and go to app>code>core>mage>core>model>session>abstract varien.php at lines 85-92:

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

change the code to this.

Apparently there are other issues such as php curl, I did not come across these but the following tut:

http://ecommercedeveloper.com/articles/1419-tutorial-avoid-two-problems-installing-magento-on-a-localhost/

covers it. Also that's where I got the information from, however the code in the version I'm using is slightly different from that version.

Upvotes: 4

Related Questions