First time When I was start working on the Magento, I have installed Magento on my local system and installation process has been completed successfully. I faced one very strange problem after fresh installation, I can not logged in Admin section. After searching in Magento commumity, finally I found the solution, here is the steps to get rid of such kind of the problem.

 

First Solution

 

Replace the http://localhost/magento/index.php/admin from the i.p. address of the localhost then it will look like as http://127.0.0.1/magento/index.php/admin. I made it work into whenever I changed my browser. Suppose I installed magento using google chrome browser and I open admin url into my firefox window and it worked. Though in the firefox the url http://localhost/magento/index.php/admin did not work, but url http://127.0.0.1/magento/index.php/admin worked fine.

 

Second Solution

 

Go to your Magento Installation directory and navigate to the app/code/core/Mage/Core/Model/Session/Abstract/Varien.php file.

 

Find the code:


session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath(),
$this->getCookie()->getDomain(),
$this->getCookie()->isSecure(),
$this->getCookie()->getHttponly()
);

 

and replace with


session_set_cookie_params(
$this->getCookie()->getLifetime(),
$this->getCookie()->getPath()
//$this->getCookie()->getDomain(),
//$this->getCookie()->isSecure(),
//$this->getCookie()->getHttponly()
);

 

After this save the file and I think it will work now.