Win7镜像文件多大:Win7上的 XAMPP太慢

我在 Windows 7 Ultimate 上运行 XAMPP 1.7.1。除了速度,一切(Apache & amp;MySQL)都工作正常。

当我打开http://localhost/时,我必须等待大约 1-3 秒才能查看网页。在我看来,它最多应该是几百英里。

基本事实:

在等待加载 localhost 网页时,状态栏显示“正在等待 localhost...”

CPU 仍处于空闲状态(加载时不增加活动)

在 localhost 上没有苛刻的 PHP 脚本,问题是当有简单的 phpinfo()时,即使有很长的重脚本。

禁用 MySQL 服务器不影响速度

我的电脑:AMD Turion 64 X2;1,6 GHz 双核,2 GB RAM,100 GB 硬盘

我做了一个简单的基准 PHP 脚本来测试 HDD / CSS 速度:

<?php
function getmicrotime() { 
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}
function testReadWrite() {
 $timeStart = getmicrotime();
 $filename = "test.txt";
 file_put_contents( $filename, '' ); // prepare empty file
 for ( $i = 0; $i < 1000; $i++ ) {
  $a = file_get_contents( $filename );
  file_put_contents( $filename, $a . '.' );
 }
 return round( getmicrotime() - $timeStart, 3 );
} 
function testCpuSpeed() {
 $timeStart = getmicrotime();
 $var = '';
 for ( $i = 0; $i < 100000; $i++ ) {
  $var = sha1( md5( $i * $i * $i * $i * $i * $i * $i * $i * $i * $i ) );
 }
 return round( getmicrotime() - $timeStart, 3 );
}
echo "Read/write #1: " . testReadWrite() . "<BR>";
echo "Read/write #2: " . testReadWrite() . "<BR>";
echo "Read/write #3: " . testReadWrite() . "<BR>";
echo "CPU speed #1: " . testCpuSpeed() . "<BR>";
echo "CPU speed #2: " . testCpuSpeed() . "<BR>";
echo "CPU speed #3: " . testCpuSpeed() . "<BR>";
?>

我的电脑结果:

读 / 写:5.134 / 3.431 / 3.494

CPU 速度:0.816 / 0.767 / 0.795

一个虚拟主机的结果:

读 / 写:7.768 / 7.69 / 7.371

CPU 速度:0.232 / 0.234 / 0.234

器的结果之一(作为空闲计算机几乎和我的 PC 一样,但速度快一点):

读 / 写:0.088 / 0.168 / 0.185

CPU 速度:0.191 / 0.189 / 0.189

所以我不认为这是因为我的 PC 速度,但我确信还有另一个问题。你有 Windows 7(或 Vista)上的 XAMPP 速度的经验吗?

谢谢

44

如果 XAMP 在 Windows 7 下运行缓慢,则防火墙设置没有区别。
Security Essentials 防病毒没有区别。

为了解决这个问题,有两件事有很大的不同:

1)在 Windows\ system32\ drivers\ etc\ hosts 中添加以下行:

127.0.0.1 127.0.0.1

127.0.0.1 localhost

2)如果您使用 PHP,在 XAMP php.ini 文件中取消注释 eaccelerator 行:

zend_extension = "C:\ xampp\ php\ ext\ php_eaccelerator_ts.dll"

在这两个更改之后,重新启动 Apache,它会更快。

15

不知道这可能是你的问题的原因,但这可能是一个想法:你有一条线,看起来像这样:

::1 localhost

在您的主机(它应该像C:\WINDOWS\system32\drivers\etc\hosts,如果我没记错的话)文件?

如果是,则通过在开头添加#来注释该行。


这样,关于 localhost 的唯一行应该是

127.0.0.1    localhost

这是一个 IPv4 地址;你评论的是一个 IPv6-这对你正在尝试做的事情没有用。


正如我所说,不确定你的问题与此相关,但我已经看到这个 sugestion 帮助了几次问题非常类似于你的(即在服务器上做任何事情之前等待很长时间)

15

使用 XDEBUG 注释 PHP.ini 中的行:

;[XDebug]
    ;zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
    ;xdebug.profiler_append = 0
    ;xdebug.profiler_enable = 1
    ;xdebug.profiler_enable_trigger = 0
    ;xdebug.profiler_output_dir = "C:\xampp\tmp"
    ;xdebug.profiler_output_name = "cachegrind.out.%t-%s"
    ;xdebug.remote_enable = 0
    ;xdebug.remote_handler = "dbgp"
    ;debug.remote_host = "127.0.0.1"
    ;xdebug.trace_output_dir = "C:\xampp\tmp"
    I disabled Bitdefeender -> no result
    I added lines to hosts -> no result
    I disabled xdebug - x2-x3 faster 

Best regards Barto

11

我在 Win 7 XAMPP 上遇到了类似的问题。问题是由我的防病毒软件引起的。启用它时,即使是最简单的 PHP 页面也需要花费超过半秒的时间才能打开。具有大量链接的大型 PHP 脚本需要_once()花费超过 1,5 秒的时间。禁用防病毒后,所有内容都会迅速变亮(每个简单页面不到 100 英里,而真正沉重的东西(100 英里)则需要

我使用 bitdeffender,这里是它的解决方案:

简单的解决方案-使用 xampp 时,只需将 bitdefender 切换为game mode

“高级”解决方案-转到Antivirus -> Shield -> Advanced Settings -> Exclusions Tab并在那里为 httpd.exe 添加排除(位于您的 xampp 安装 / apache / bin / 中)。然后转到Antivirus -> Exclusions并为您的 php 文件所在的目录添加排除。

不要忘记在上述步骤后重新启动 Apache。

或者,您可以安装 eaccelerator 来提高速度。

正如我所说:我发现 WAMP 作为一个项目比 XAMPP 不成熟。

旁注 2:最好的解决方案是将您的旧 PC 用作 linux 服务器,一切都将像魅力一样工作:-)

本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处

(918)
Mysql工具:MySQL性能工具(database performance tools)
上一篇
网页申请qq:什么意思:qq= qq| | {}(what does qq mean)
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(87条)