WAMP/XAMPP is responding very slow over localhost
Solution 1
I had the same problem running on Windows 8 running on 64bit. Apache is really slow but when you press F5 many times it goes ok. In the end i after doing many things managed to solve it. Right now it works fast.
Try the following tasks to increase the performance:
Change apache's listening port
Change listening port from 80 to 8080 to avoid conflicts with programs like Skype. Open your httpd.conf file and find the line that starts with Listen
(it's around line 62). Change it like the following:
Listen 127.0.0.1:8080
Change your powerplan
Change your power plan from Balanced to High Performance. You can do this in Control Panel\All Control Panel Items\Power Options
Disable IPv6
The credits of this particular task go to Jef where he pointed this out in his blog post. From the Windows 8 desktop, press the Windows Key
and the R key
at the same time
Type regedit in the Run dialog box and click OK
Use Registry Editor to expand the registry tree and browse to:
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\Parameters
Right click on Parameters
, expand New
, and select DWORD (32-bit)
Value
Enter DisabledComponents
into the Name
field
Double click on the new DisabledComponents
value, enter ffffffff
into the Value data
dialog box, and click the OK
button
Confirm the new registry value contains the required data.
Change your etc/hosts
If you use virtual hosts don't add each virtual host on a new line. Instead list them like the following.
127.0.0.1 site-a site-b site-c
I also added 127.0.0.1 127.0.0.1
since I heard this somehow improves the lookup as well. (Can't confirm this but it can't hurt putting it there)
Your hosts file is located at C:\Windows\System32\Drivers\etc
Check how many apache processes are running
In my case I had two apache processes running. Be sure you only have one running. You can check this by pressing CTRL+ALT+DEL
and press Task Manager
Turn off the Base Filtering Engine (BFE)
What I find to be working a bit as well was turning off the Base Filtering Engine. Since stopping or disabling the BFE service will significantly reduce the security of the system you should only do this when needed.
Go to Control Panel => Administrative Tools => Services => Base Filtering Engine
Stop the Base Filtering Engine by clicking on Stop
Increase Apache's process priority
To to your task manager and change Apache's process priority from Normal to High by right clicking -> Set priority -> High
Keep Apache's process busy
This is a bit of an ugly method but it does certainly work. It keeps Apache busy and will process your own requests faster. Insert your local web-address in the iframe location and save it in a html file, run it and just leave it there until you're done.
<html>
<head>
<script>
setTimeout(function(){
window.location.reload(1);
}, 2000);
</script>
</head>
<body>
<iframe name="iframe" id="iframe" src="http://mywebsite:8080"></iframe>
</body>
</html>
Downgrade to Windows 7 Pro
As a Windows 8 Pro user you are entitled to have downgrade rights to Windows 7. Read here more about this. For me that was the only solution that really did the job properly.
Good luck!
Solution 2
This is caused by IPV6. Here is how you make MYSQL not use it. (so, without disabling IPV6)
edit mysql file 'my.ini'
under [wampmysqld]
or [mysqld]
add the following:
bind-address = ::
Save file and restart mysql service
enjoy!
Solution 3
have a look here :
http://forum.wampserver.com/read.php?2,91602,page=3
Basically use 127.0.0.1
instead of localhost
when connecting to mysql through php on windows 8
if your finding phpmyadmin slow
in the config.inc.php
you can change localhost to 127.0.0.1
also
Solution 4
The solution that worked for me was to disable the cgi_module. Use one of these methods:
(Method 1) Right 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.
Solution 5
In my case, load time is 5 times faster when this is disabled in php.ini :
;zend_extension = "\xampp\php\ext\php_xdebug-2.1.0-5.3-vc6.dll"
FBwall
Updated on January 16, 2021Comments
-
FBwall over 3 years
I don't know what the problem is. WAMP was very slow, so I reformatted my computer and installed WAMP. Still, accessing localhost is very, very slow, and sometimes it doesn't even load at all. I even removed it and replaced it with XAMPP, but I still got the same result. What might possibly be the problem? Here's my current hosts file:
127.0.0.1 localhost 127.0.0.1 localhost
It was perfectly working fine before, but I do not know what happened and why it has started acting strange lately, since even a reformat didn't fix it.
-
wowpatrick over 11 yearsThat speed up the request time by about 80%. Why is PHP so slow to connect to MySQL with localhost under Windows 8?
-
AgelessEssence almost 11 yearsthis is a good collection of answers, the only thing i did and work for me was disabling IPv6, thats all, so thanks ;)
-
Benno over 10 yearsThis didn't fix it for me :( I know it fixed once in the past, but for some reason it isn't working now, sadpanda.
-
Synetech over 10 years
I also added 127.0.0.1 127.0.0.1
That’s not even valid syntax for aHOSTS
file; you cannot remap an IP address.Check how many apache processes are running. In my case I had two apache processes running. Be sure you only have one running.
What‽ You’re supposed to have two instances ofhttpd.exe
; that’s expected and normal. The second one is the worker which does the main work, and the first is just the monitor which can restart the worker if it crashes. You only get one in debug mode which is not meant for regular use. -
bicycle over 10 yearsAll these things may be not valid, regular, etc but at least it makes apache go faster. That you have to wait ten seconds to load a page is also not expected but is regular in Windows systems. In the end it may be better to switch to Mac or Ubuntu if you don't mind the bugs within the system.
-
Martin Asenov over 10 yearsVery nice, thorough comment, but with little downside for me... instead of putting Apache on port 8080, we'd better disallow Skype to use ports 80 and 443. It is done in Skype's connection settings. Pointing to 8080 is not a good practice from a developer's point of view, basically because it may conflict with Apache Tomcat that runs on default on 8080, and is also included in the XAMPP package.
-
BrownChiLD over 9 yearsJust wanted to give my big thanks to this answer.. this helped me speed up my queries!
-
Pascalculator over 9 yearsI've been looking for the cause of this for more than a year now. For me, this was the main and sole culprit. Here's a post that describes what you can do besides having to disable Xdebug: stackoverflow.com/questions/24893010/… Thanks!
-
Pavel V. over 9 years@MartinAsenov: if it's only Skype, that's fine, Skype can be easily redirected to another port. But I have port 80 issues with few other programs like Dropbox, which is not so easy to move to another port.
-
Ejaz over 9 yearsIt reduced the response time to 20% on windows 8.1. Thanks for the answer. Same question as wowpartick's
-
hbit about 9 yearsThanks, thanks, thanks, thanks!!! I have been trying everything that is writte up here and elsewhere. And XDEBUG was that thing that made phpMyAdmin slow as hell. And now it flyes again!
-
Martyn Shutt about 9 yearsExact same problem, even with a newer copy of the extension. Just quicker for me to comment it out when not needed, but probably related to one of the other .ini settings with the extension.
-
AndiPower almost 9 yearsPerfect! I gave your answer a 5% chance that it would help, but it really did! thanks.
-
user2345998 almost 9 yearsGreat - it reduced the request time from 1,03 sec. to ~15ms. Thanks! (Using win8.1 64bit)
-
user2345998 almost 9 yearsI suggest to put Stephan's apprach (change localhost to 127.0.0.1) at the top of the list, since this seems to be the reason very often and is quite easy to test.
-
Sabeer almost 9 yearsThanks man Speed improved a lot... As I am using XAMPP I have added it under [mysqld]
-
Aldry Wijaya almost 9 yearsThis trick has helped me a lot.. it makes my MySQL server almost 100x faster.. it will works on WAMP or XAMPP.. For XAMPP, just remove the # sign before "bind-address = ::" line..
-
vladkras over 8 yearsunfortunately didn't help at all. I've added
[wampmysqld]
section to my/opt/lampp/etc/my.cnf
(this config is loaded, I don't have .ini file), restarted, but nothing happened. Anyway thanks for effort. At least it helped someone -
NullPointer over 8 yearsYou save me friend (y). Hats off for you.
-
user1447420 over 8 yearsThanks for great solutions. I fixed the problem by disabling ipv6.
-
Matt over 8 yearsPrioritizing the httpd.exe fixed it.
-
phil294 over 8 years"In my case I had two apache processes running. Be sure you only have one running. " - stopping one of them will also kill the other one. Not helpful.
-
phil294 over 8 yearswampmysqld section does not exist in current xampp
-
Rick Kukiela over 8 years@vladkras you need to add it to your [mysqld] section. AND THIS TOTALLY WORKED! THANK YOU!!!!!
-
Marco Demaio over 8 years+1 It works like a charm! This one on its own did the trick! I'm on Windows 7 Pro + Apache 2.4 + PHP 5.5.30.
-
user3640967 over 8 yearsYou hero! In the end I left xdebug enabled, but turned off the profiler and my script sped up from around 5 minutes to 5 seconds. Thank you!
-
fidev over 8 yearsThis work for me. Using El Capitan (MAMP) + Apache 2.2.29 + PHP 5.6.10. Especially the lag when running Parallels IE Test Environment.
-
Guntram about 8 yearsfor me, this was the only thing to speed it up. surprisingly, internet explorer 11 was really fast with xdebug enabled. chrome and ff were slow as hell...
-
Juan almost 8 yearswhat about for a real operating system, like osx?
-
luky over 7 yearsi had same problem, windows 8, phpmyadmin on localhost was opening one small table (29k rows) forever.. once i changed address in URL bar to 127.0.0.1 it loaded instantly.. very strange
-
anoldermark over 7 yearsYes - I've tried lots of things - this works for me using XAMPP on W7Pro. It also seems to have fixed some annoying phpMyAdmin stalled refreshes where PMA sits there with a clock icon.
-
Muhammad Saqib over 7 yearsDisabling Base Filtering Service on windows seven wamp (x64) worked for me.
-
Leopoldo Sanczyk over 7 yearsThank you. I recovered the faith in technology.
-
Fuxi over 7 yearsi've tried ANYTHING but changing the power plan did the trick - thanks!
-
webcoder about 7 yearsWe should follow Microsoft's recommendations about disabling IPv6 - Reference Link
-
Kevin about 7 yearsI'm using Windows Defender and this solution worked for me, I just added the three files to the "Excluded processes" list in Defender
-
AdRock about 7 yearsThis is the only thing that worked for me. All the other known fixes I tried and didn't work but this did
-
Andrei Surdu almost 7 yearsYou are my hero!
-
Oliver over 6 yearsI just commented
[XDebug]
block inphp.ini
and speed was normal again -
Jones G over 6 yearsYour a savior! That was causing the problem, now I got 90% improvement in site speed in localhost!
-
Biju P Dais about 6 yearsUpdated my.ini for xampp with this and my localhost became lightning fast!!! Cheers to you!!!!
-
kosmos about 6 yearsDisabling the xdebug extension (zend_extension line) worked for me. Now I need a new debugger -.-" Thanks for pointing me to the right direction
-
Xedecimal almost 6 yearsOne more tip, you are limited to 10 hosts per line in the hosts file. Once you add that 11th one it'll stop recognizing them so make sure you don't add too many on a single line... Thanks Microsoft!
-
Marcelo Agimóvel almost 6 yearsJust remember to execute as admin.
-
Agung Sagita over 5 yearsfirst thing i do this and its working wonderfully, other tricks answered above definitely might work, just because this at the bottom of answers, i tried this first and solve my problem, cool !
-
dregad over 5 yearsChange your etc/hosts [...] don't add each virtual host on a new line. pointed me in the right direction. It turns out that for some unknown reason I had multiple
127.0.0.1 localhost
lines in my hosts file; after removing the extra ones, page loads went from over 5 seconds on average, to under 1 s. -
Silvio Delgado about 5 yearsIt was exactly what happened to me. Thank you for remember me!
-
FlavioEscobar about 5 yearsMan, thank you so much for that! Tried so many other things but this was the one and only solution that worked.
-
moshiuramit almost 5 yearsUsing wamp didn't expected that it will be work. And yet it worked. Thank you.
-
tayyab almost 5 yearsThanks, just changing the port to 8080 solved all my issues
-
Gisto about 4 yearsTHIS!!!! You are a life saver, spent hours and hours trying to get to the bottom of this!!
-
sonnb about 4 yearsThis is the reason of my slow with XAMPP. x10 faster after follow this instruction.
-
Mohammed Cherkaoui about 4 yearsThis worked like charm for me, I've been struggling with this problem for weeks
-
Federico Schiocchet almost 4 yearsIt didn't fix it, and I'm not surprised of that. Of course the link is not the cause
-
hameds1 over 3 yearssetting apache high priority worked for me
-
summsel about 3 yearseven 2021 this solution is working! Win10, Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.11 Datenbank-Client Version: libmysql - mysqlnd 5.0.12-dev
-
Engr. Meshach Koech over 2 yearsThis solution worked for me, I tried all the others but noticed in my task manager once I launch the local host, very many processes related to bit defender service host will start running. Added the exceptions to bit defender and now works like charm.
-
not_a_generic_user almost 2 yearsDespite all the detailed stuff above (most of which I did other than turning off BFE and other things that seemed like bad ideas, THIS was the one that worked. In my my.ini under [mysqld], there's an entry already for bind-address that goes to 127.0.0.1. I changed it to :: and phpmyadmin results show instantly now instead of after 10 to 20 seconds.