29

I am using WAMP (localhost) on Windows 7.

When I am running my localhost it takes more than 1 minute to load the page. There are no queries or database connectivity. If it's just an HTML page, it also takes the same time, and if the Internet is connected it works normally. If Internet is connected it works perfectly. When the Internet is not available it takes more than 1 minutes to load a simple page.

How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Terish Das
  • 291
  • 1
  • 3
  • 3
  • 3
    You surely have something in that HTML page that requires an internet connection. Can be, for example, a JS external file, a social widget (Facebook, Twitter, ...), images, etc... – lorenzo-s May 25 '12 at 08:26
  • Look at the relation section, there is similar issues discussed – Aurimas Ličkus May 25 '12 at 08:26
  • Does page includes external link or fetching images/block/js from external links?? – swapnesh May 25 '12 at 08:26
  • he doesn't say that it stops loading after 1 minute and the page is broken, just that it takes long time to load. – Gavriel May 25 '12 at 08:27
  • 1
    possible duplicate of [wamp/xampp localhost responding very slow](http://stackoverflow.com/questions/8432601/wamp-xampp-localhost-responding-very-slow) – madth3 Aug 20 '13 at 19:07
  • Excellent answer here - https://www.devside.net/wamp-server/wamp-is-running-very-slow – T.Todua Jul 16 '16 at 17:48

22 Answers22

49

The solution that worked for me was to disable the cgi_module. Use one of these methods:

(Method 1) Left click on WAMP > Apache > Apache Modules > uncheck "cgi_module"

(Method 2) Edit httpd.conf and disable the loading of the CGI module by commenting this line:

LoadModule cgi_module modules/mod_cgi.so

Commenting would be just adding a # in front, like this:

#LoadModule cgi_module modules/mod_cgi.so

Restart the Apache service and you should be good to go.

PaulH
  • 2,918
  • 2
  • 15
  • 31
noname
  • 1,268
  • 1
  • 16
  • 21
32

Set mysql_connect('127.0.0.1'... instead of mysql_connect('localhost'....

WAMP/XAMPP is responding very slow over localhost

Community
  • 1
  • 1
Marko Aleksić
  • 1,591
  • 1
  • 18
  • 24
17

I tried a lot of the answers on here without much success. It was PHP itself where the bottleneck was occurring. I disabled Xdebug and my page-load time went from ~1200 ms to ~275 ms. That was where the biggest single gain occurred, by far.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
tvanc
  • 3,807
  • 3
  • 25
  • 40
8

Instead of using the hostname “localhost”, use an IP address in your MySQL connection string.

Typically, your WAMP installation is found in C:\wamp. Edit this file with Notepad:

C:\wamp\www\wp-config.php

Replace

define("DB_HOST", "localhost");

with

define("DB_HOST", "127.0.0.1");

Restart the WAMP services.

You can check out more details on this website.

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
Booni
  • 81
  • 1
  • 3
3

Changing the PHP SMTP server in file php.ini from localhost to 127.0.0.1, on line 1084 in my vanilla copy, did the trick.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fluffy
  • 135
  • 1
  • 7
3

Accessing my local content on 127.0.0.1 instead of localhost worked for me (so probably a DNS resolve issue is hidden somewhere):

  • http://127.0.0.1/mysite is fast

  • http://localhost/mysite is slow

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nicolas Janel
  • 3,025
  • 1
  • 28
  • 31
3

Here is a list of changes I made to make WAMP faster in my Windows 10 Pro 64 bit:

  1. Edited hosts file and added: 127.0.0.1 localhost
  2. Edited hosts file and added: 127.0.0.1 myVhosts (note: I added all other entries in the same line as the first one. I don't create multiple lines to point 127.0.0.1 to different places. So I only have one 127.0.0.1 and then next to it, any vhosts or anything else that I want to point to it)
  3. Edited my.ini and added: bind-address="127.0.0.1" (below [wampmysqld64])
  4. Disabled cgi_module from Apache** → Apache Modulescgi_module (uncheck it)
  5. Disabled XDEBUG Extension from php.ini
  6. As I have Anti-Virus and Firewall, added httpd.exe and mysqld.exe files (as well as PHP CLI and CGI binaries, and PHP’s DLL files) to the exceptions.
  7. Turned on EnableMMAP and EnableSendfile in httpd.conf
  8. Set realpath_cache_size to 4096k in php.ini
  9. In the end, edited the configuration file of projects and replaced the localhost with 127.0.0.1 as well.

I also recommend checking this article: WAMP is Running Very Slow. They covered a lot of changes that may help you as well.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Hamed Azimi
  • 145
  • 10
2

Uncommenting this line in the hosts file worked for me:

# 'localhost' name resolution is handled within DNS itself.
    127.0.0.1       localhost
#   ::1             localhost

Uncommenting 127.0.01 localhost. And after that it's super fast.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ricky Sharma
  • 1,839
  • 3
  • 24
  • 44
2

I'm running Windows 8, and WAMP was very slow. I did all suggested before. With a difference; WAMP had httpd.conf by default:

AcceptFilter http none
AcceptFilter https none

So I did the contrary thinking: Maybe this is not needed any more. It seems to work fine:

 #AcceptFilter http none
 #AcceptFilter https none

Maybe is not a problem in all Windows versions. In httpd you read:

# AcceptFilter: On Windows, none uses accept() rather than AcceptEx() and
# will not recycle sockets between connections. This is useful for network
# adapters with broken driver support, as well as some virtual network
# providers such as vpn drivers, or spam, virus or spyware filters.
#AcceptFilter http none
#AcceptFilter https none
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Daven
  • 21
  • 1
2

Adding to tvanc's answer, also disable the Xdebug profiler in php.ini with xdebug.profiler_enable=Off or xdebug.profiler_enable=0.

You might also increase the PHP memory limit. Search for memory_limit in php.ini.

There are also some useful tips at WAMP is Running Very Slow which are too numerous to list here.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
AlphaCactus
  • 418
  • 3
  • 8
  • There is a long list of things that make a wamp Pro on macos slow. With me it was the profiling setting in php.ini file. Without knowing I enabled XDebug Profiling, which wrote out with every request files of the size of 300MB. Of course things went wrong and rendering a site took 1Min. Thanks for pointing this out – Marc Loeb Aug 27 '20 at 12:54
1

My problem was of a smaller scale. An empty PHP page went from almost instant rendering to about 1 second.

It turned out that my Xdebug settings were causing the problem. I had xdebug.remote_enable=on set in the php.ini file, and this was causing the delay. Before I was starting, the debug session was using an idekey, so I only got the delay when starting a debug session. Commenting the line out solved the problem.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
SystemicPlural
  • 5,629
  • 9
  • 49
  • 74
1

Turning off the cgi_module also worked for me with WAMP + WordPress. I wanted to share that you can also do this with the WYSIWYG in WampServer 2.5.

  • Click on the WAMP Quick Launch Icon in the Taskbar.
  • Hover over ApacheApache Modules
  • Click to remove the check mark from cgi_module

WAMP should restart itself, and you should see the speed pick up.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nate R.
  • 11
  • 1
0

This issue was plaguing me after I upgraded WAMP Server from 2.2 to 2.4.

I eventually found the solution, as detailed in this blog post: Apache server 2.4.6 hangs after serving requests from Internet Explorer 10/11

Add the following to Apache's configuration file (httpd.conf):

AcceptFilter http none
AcceptFilter https none
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

This may sound really simple, but if you are using Notepad++'s menu RunLaunch in <browser> option (e.g. Launch in Firefox), it loads as file:///C:/wamp/www/dynamic/index.php instead of localhost/dynamic/index.php.

If this is the case then try going to localhost/dynamic/index.php in the URL bar on your own, and it will load much faster.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

I ran into this issue specifically in Chrome. Emptying the browser cache completely solved it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Alan Johnston
  • 186
  • 1
  • 3
0

In my case the slowness was because I was on a corporate VPN and also had a proxy URL set in Chrome. Off the VPN everything loaded fast.

To get things to work on the VPN, I removed the proxy setting from Chrome. Things mostly worked then, but a search for WordPress plugins or themes from the dashboard still failed.

I added the following to wp-config.php and then search worked too:

 /** proxy settings */
 define('WP_PROXY_HOST', 'proxy.url.com');
 define('WP_PROXY_PORT', '1234');
 define('WP_PROXY_USERNAME', '');
 define('WP_PROXY_PASSWORD', '');
 define('WP_PROXY_BYPASS_HOSTS', 'localhost');
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
inky
  • 1,462
  • 14
  • 17
0

I ran into the same problem and changed all the options mentioned.

After that, I saw that a Drupal database with extreme weight was causing the problem. Clearing the watchdog table and cache solved the problem.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

I tried everything, and nothing worked. Then I found out by removing all session references WAMP was 20 times faster. As the sessions were being locked, so when the same application requested multiple pages it was super slow.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Nav
  • 9
  • 1
0

I followed all these and the links with no joy. Gold for my Wamp v7.3.16-2 was setting bind-address=:: in MySQL's my.ini file. Response time went from minimum of 2 seconds to zero.

Thanks to http://regularcoder.com/tutorial/wamp-optimization-for-better-performance/#comment-30

betakilo
  • 81
  • 1
  • 7
-1

I've found that it somehow helps a lot not to reload the page, but rather go to another page, and click the link (if it it exists) to the previous page

I do this, since I have a menu bar, so I just click another link, and then back.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Daniel Holst
  • 139
  • 10
-1

Run WAMP only. Quit other applications which use the Internet.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
vivek
  • 1
-2

Add 127.0.0.1 as your DNS in Use the following DNS server addressesPreferred DNS server

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131