Saturday, January 7, 2012

Magento 6 localhost issue can change to 127.0.0.1

First thing you got to do is look for a file named Varien.php which is located same way as the following.

[magento_url]\app\code\core\Mage\Core\Model\Session\Abstract\Varien.php

In my case, magento_url represents 'c:\wamp\www\magento'.

Using your text-editor, open the said file. Look for the code around line 78 that reads 'session_set_cookie_params(...);'. Then enclose the entire code block inside a multi-line Comment (/* ... */).

It should look something like the following.


// set session cookie params
/*
session_set_cookie_params(
    $this->getCookie()->getLifetime(),
    $this->getCookie()->getPath()
    $this->getCookie()->getDomain(),
    $this->getCookie()->isSecure(),
    $this->getCookie()->getHttponly()
);
*/

Well there you have it. This is the shortest workaround I've found in Magento Forums. Once you get this working, you'll never have to replace http://localhost/ into http://127.0.0.1/ ever again. If you're not convinced, try running another fresh installation of Magento. Fix Varien.php, then access the backend or admin section. You'll be surprised the problem's gone!

This piece of solution is offered for development purposes only. This might not be a good idea for a production environment. Please bear that in mind.

No comments:

Post a Comment