WAMP/XAMPP is responding very slow over localhost

霸气de小男生 提交于 2019-12-27 12:08:24

问题


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.


回答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!




回答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 the [wampmysqld] add the following:

bind-address = ::

Save file and restart mysql service

enjoy!




回答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




回答4:


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"



回答5:


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.




回答6:


For me using xDebug, this line in php.ini was the performance killer:

xdebug.remote_autostart=true

When I removed it the page was fast again.




回答7:


if you are using mysql use 127.0.0.1 instead of localhost in mysql_connect function it helped me




回答8:


I'm not yet able to comment under @Honesta answer, so I'll write here the way I manage to solve it.

My environment (I don't know if this is relevant for the answer)

  • XAMPP (version 5.6.3)
  • Windows 8.1 Pro (64 bit)

How to

I just opened my.ini file and uncommented the line where it says

bind-address="127.0.0.1"

This file is located, for XAMPP users, in C:\xampp\mysql\bin\my.ini.

Credits

This article helped me to solve the problem, although I didn't needed everything in it because some setup in XAMPP were not requested.




回答9:


As most of the answers have pointed out, using the IP address 127.0.0.1 over "localhost" will sometimes help the slowness issue - but this isn't really a solution because it does not fix the underlining problem.

What makes this problem hard (and hit-and-miss), is it can be caused by about a dozen different things between the OS, the WAMP configuration, and your Browser.

  1. Remove ::1 localhost from your Windows hosts file, and make sure 127.0.0.1 localhost is present. You want your request to go directly to the listening IPv4 socket.

  2. Disable IPv6 on your system. You are most likely not using it, and it has been known to cause all kinds of issues.

  3. Exclude your Apache and MySQL binary paths, and the Database folder, from your firewall and anti-virus software. They will interfere and slow things down.

  4. Reset your TCP/IP sub-system and reboot: netsh int ip reset c:\resetlog.txt

  5. Make sure your system is not using stale DNS servers: ipconfig /all

  6. Flush Windows DNS cache: ipconfig /flushdns

  7. Clear your Browser's Cache.

A little more in-depth is this guide: WAMP is Running Very Slow




回答10:


I've just fixed such an issue on my laptop running windows 10. Suddenly wamp became super slow - a request to load a page was taking 2 minutes.

After trying numerous things, what it turned out to fix the problem was disabling windows defender. All worked like a charm after that.

p.s. I'd suggest you add your apache root dir to the exceptions list and not actually disable defender completely.




回答11:


For my it was the xdebug. I disabled and it worked as it should be !

[XDebug]
zend_extension = C:\xampp\php\ext\php_xdebug-2.3.2-5.6-vc11.dll



回答12:


After try each instuction on this post, for me works when i add in:

Avira >>
Real-Time Protection >>
Configuration >>
Exception >>

Add Proccess:

  1. xampp\apache\bin\httpd.exe
  2. xampp\mysql\bin\mysqld.exe
  3. xampp\xampp-control.exe




回答13:


I am using wamp64 on my windows 10 machine. I was having the same issue and turning off Xdebug of from my php.ini file resolves the issue for me.

; [xdebug]
; zend_extension ="C:/wamp64/bin/php/php5.6.25/zend_ext/php_xdebug-2.4.1-5.6-vc11-x86_64.dll"
; xdebug.remote_enable = off
; xdebug.profiler_enable = off
; xdebug.profiler_enable_trigger = off
; xdebug.profiler_output_name = cachegrind.out.%t.%p
; xdebug.profiler_output_dir ="C:/wamp64/tmp"
; xdebug.show_local_vars=0



回答14:


I had the same problem. Response times were extremly slow and refreshes worked quickly, most of the time. All suggestions made by bicycle didn't help. What seems to help best so far (no slow response times for the last 30mins) was to reset winsock as explained here: http://www.devside.net/wamp-server/wamp-is-running-very-slow

netsh winsock reset
netsh int ip reset C:\resetlog.txt

You need to restart after this.




回答15:


Using Windows 10 (june of 2018), I managed to improve the loading that went from 2 seconds to less than 400 milliseconds doing a set of things I saw in this post and the internet

Disabled xdebug in php.ini

; [xdebug]
; zend_extension ="C:/wamp64/bin/php/php5.6.25/zend_ext/php_xdebug-2.4.1-5.6-vc11-x86_64.dll"
; xdebug.remote_enable = off
; xdebug.profiler_enable = off
; xdebug.profiler_enable_trigger = off
; xdebug.profiler_output_name = cachegrind.out.%t.%p
; xdebug.profiler_output_dir ="C:/wamp64/tmp"
; xdebug.show_local_vars=0

Used 127.0.0.1 in installation, in my case of Wordpress

Using @honesta method

edit mysql file 'my.ini'

under the [wampmysqld] add the following:

bind-address = ::

And disabling cgi module like @Iulian Dita said

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.



回答16:


I had this problem too.

I added the entries suggested above but it failed to work.

It was due to the fact Spybot Search and Destroy had added 15,000 lines of immunized site (ie prevents you from visiting them) to my hosts file.

My hosts file was 433k - I removed those lines and my page load speed improved immensely.




回答17:


Changing(Updating) my PHP version from 5.5.25 to 7.0.10 solved this problem in my case.




回答18:


Power plan was the problem.Changed Balanced to High performance.




回答19:


Had the same issue in Chrome and it did not go away after applying all the known remedies. For me the resolution was to uncheck "Enable phishing and malware protection" in Chrome settings (Settings -> Show advanced settings -> Privacy). After that localhost is lightningfast.




回答20:


After trying EVERY SINGLE answer and comment here, and nothing helped me, I finally found a solution! In this article The correct way to configure PHP I find a new way to configure PHP as a module in Apache. For the author of this article, the official way to configure PHP is not the most optimal. The common and inappropriate way to configure PHP is this one:

# For PHP 5:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

I've always done it this way, but in the article, it's suggested to configure the PHP module this way:

#For PHP5
LoadFile "C:/www/php5/php5ts.dll"
LoadModule php5_module "C:/www/php5/php5apache2.dll"

<IfModule php5_module>
    #PHPIniDir "C:/Windows"
    #PHPIniDir "C:/Winnt"

    <Location />
        AddType text/html .php .phps
        AddHandler application/x-httpd-php .php
        AddHandler application/x-httpd-php-source .phps
    </Location>

</IfModule>

I even have IPV6 enabled, and my loading time drop down from 45 secs or 1 minute or more, to just 2 or 4 seconds! Thanks to other answers mentioned here, I also left enabled in my general configuration the following

HOST FILE:

127.0.0.1       localhost
127.0.0.1       127.0.0.1
#   ::1         localhost

HTTPD.CONF

EnableMMAP on
EnableSendfile on
AcceptFilter http none 
AcceptFilter https none
HostnameLookups Off

Other than that, I rolled back all other solutions I tried, so I'm sure this is the only ones that I used. I wish this is helpful for someone =)




回答21:


I have the same issue but I resolve issue from database.I had rename table name and create new table with out index through which all indexes effected and I had huge amount of data in table.I again rename original table, it has fixed for me.




回答22:


If you are using PHP Xdebug for debugging purpose, remove that file. It worked for me. The response time reduced from 950ms to 125ms.




回答23:


I don't know why, but closing my internet connection solved this problem for me.




回答24:


Just try "Incognito" mode in Chrome.

Finally, this helped me to solve my issue.

Please keep your mind, this is not a permanent solution.




回答25:


I run on wamp and I had this problem once. There can be many factors to this though there is 5 main ones that come to my mind.

1st. A program can cause this(Even antivirus software just depends what you have.)

2nd. Is your computer full or using alot of space this happen to a partner site of mine.

3rd. Check your regerstry files there could be errors or other things. (This end up being my problem.)

4th. After you uninstalled it did you manually delete the files that were left on your computer.(Yes even after you uninstall with wamp it has a tendency to leave a folder or 2 with some important data on it. When you install this will not be remodified and will stay the same.)

5th. Download the latest wamp or the lastest stable version of it.

Hope one of these things help.



来源:https://stackoverflow.com/questions/8432601/wamp-xampp-is-responding-very-slow-over-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!