It's been months since I was trying to figure out WHY was PHP and Apache sooo damn slow on localhost !

I tried uniserver, xampp, wamp, all kind of server bundles which were offering PHP/Apache/MySQL. I was even thinking about developing under Ubuntu linux.

Whenever I tried to refresh a page, it took approximately 3 seconds or even more. Very annoying !

 

I found several posts around the internet such as:

http://drupal.stackexchange.com/questions/13316/very-slow-drupal-loading-on-localhost-via-uniform-server

 

Most of them are instructing you to add lines to windows hosts file. You know what? It doesn't help !

 

What worked for me regarding slow Apache / PHP on localhost

 

>>> I changed localhost to 127.0.0.1 in configuration.php of Joomla installation. That's all !  <<<<

 

I'm currently using Uniserver, which is really great.

If you're using Wordpress, some other CMS, or even no CMS at all, you have to change it in some main database configuration file.

 

Results before running command "wget.exe localhost"

Start time: 2014-12-21 15:28:18
End time:  2014-12-21 15:28:24 (6 seconds difference ! )

 

After the modification:

Start time: 2014-12-21 15:38:21
2014-12-21 15:38:22 (1 second difference ! )

 

waiting 6 seconds vs 1 second can be a huge difference if your're doing some development on localhost !

If I knew that some time ago it could have saved me hours waiting for damn f*** windows trying to resolve localhost to 127.0.0.1 even though this entry was in etc/hosts file !