XAMPP / WAMP / 不管它是什么:Apache 运行速度超慢

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2148131/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 18:41:34  来源:igfitidea点击:

XAMPP / WAMP / whatever it is: Apache is running super slow

apachexamppwampwampserver

提问by naitan

I've got my Windows PC (localhost) running XAMPP. It loads the pages sometimes really quick or sometimes really slow.

我的 Windows PC (localhost) 运行 XAMPP。它加载页面有时非常快或有时非常慢。

So, I figured and searched and was recommended to get WAMP. I got that and installed it. Still, the pages load so damn slowly. No heavy CPU load or anything, all my ports are open too.

所以,我想通并搜索并被推荐获得 WAMP。我得到了它并安装了它。尽管如此,页面加载速度还是很慢。没有沉重的 CPU 负载或任何东西,我所有的端口也都打开了。

Any ideas?

有任何想法吗?

回答by naitan

Here's a solution that really worked for me.

这是一个真正对我有用解决方案

One thing to try is changing the following two entries in apache/conf/httpd.conffrom OFFto ON:

有一件事是尝试改变以下两个条目apache/conf/httpd.conf来自OFFON

EnableMMAP on
EnableSendfile on

Also, enable and set realpath_cache_size= 4mto your php.inifile.

此外,启用并设置realpath_cache_size= 4m为您的php.ini文件。

If your are using InnoDB database also enable and set in my.ini:

如果您使用的是 InnoDB 数据库,则还启用并设置my.ini

innodb_flush_log_at_trx_commit = 2

Finally, it seems it worked for some people: edit your host (C:\Windows\System32\drivers\etc\hosts) by adding

最后,它似乎对某些人有用:C:\Windows\System32\drivers\etc\hosts通过添加编辑您的主机 ( )

127.0.0.1 localhost
127.0.0.1 127.0.0.1

And commenting:

并评论:

\# ::1 localhost

回答by Aziz

Try to add this lines to hostsfile:

尝试将此行添加到主机文件:

127.0.0.1 127.0.0.1

127.0.0.1 localhost

127.0.0.1 127.0.0.1

127.0.0.1 本地主机

and comment this line:

并评论这一行:

# ::1 localhost

# :: 1 本地主机

You can find hostsfile under: C:\Windows\System32\drivers\etc

您可以在以下位置找到hosts文件: C:\Windows\System32\drivers\etc

回答by cwd

Very slow is a very general problem, but it happened for me when I first installed IIS to run alongside apache, and also after I did a windows update (config was reset?)

很慢是一个非常普遍的问题,但是当我第一次安装 IIS 与 apache 一起运行时,以及在我进行 Windows 更新(配置被重置?)

Anyhow, what happened was that IIS started conflicting with Apache on port 443 (SSL) and so I had to use the follow command to disable SSL on IIS so that Apache would run fast again:

无论如何,发生的事情是 IIS 在端口 443 (SSL) 上开始与 Apache 发生冲突,因此我不得不使用以下命令在 IIS 上禁用 SSL,以便 Apache 再次快速运行:

c:\inetpub\adminscripts\>adsutil set w3svc/1/securebindings "::"

Hope this helps.

希望这可以帮助。

edit: I also found that if I had ColdFusion installed and the service timed out during startup apache would run really slow. If you have ColdFusion installed, run services.msc and check to see if the main service is running. If that works, try adjusting your startup time ( http://www.ahphosting.net/support/Customer/KBArticle.aspx?articleid=23) so it will start automatically on the next reboot.

编辑:我还发现,如果我安装了 ColdFusion 并且服务在启动期间超时,apache 的运行速度会非常慢。如果您安装了 ColdFusion,请运行 services.msc 并检查主服务是否正在运行。如果可行,请尝试调整您的启动时间 ( http://www.ahphosting.net/support/Customer/KBArticle.aspx?articleid=23),使其在下次重新启动时自动启动。

回答by Matt Vaughan

Oddly, the IP hosts/address change did the trick to me.

奇怪的是,IP 主机/地址更改对我有用。

I'm on XP, and have had "127.0.0.1 localhost" in my hosts file forever.

我使用的是 XP,并且我的主机文件中永远有“127.0.0.1 localhost”。

Recently (maybe after some Windows updates, maybe after adding other application directories to my xampp htdocs, maybe after installing something else that conflicts with those ports?) pages - even simple HTML pages - started loading extremely slowly.

最近(也许在一些 Windows 更新之后,也许在将其他应用程序目录添加到我的 xampp htdocs 之后,也许在安装了与这些端口冲突的其他东西之后?)页面 - 即使是简单的 HTML 页面 - 开始加载非常缓慢。

Merely commenting out the "127.0.0.1 localhost" line in my hosts file seems to have done the trick - now pages are loading consistently quickly.

仅仅注释掉我的主机文件中的“127.0.0.1 localhost”行似乎已经完成了 - 现在页面加载速度一致。