win7 php很慢,php – XAMPP在Win7上太慢了

我在Windows 7旗舰版上运行XAMPP 1.7.1。一切(Apache& MySQL)工作正常,除了速度。

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

基本事实:

>在等待加载本地主机网页时,状态栏会显示“Waiting for localhost …”

> CPU仍然空闲(加载时没有增加的活动)

> on localhost是没有要求的PHP脚本,问题是当有简单的phpinfo()即使有长的重脚本。

>禁用MySQL服务器不影响速度

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

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

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() . "
";

echo "Read/write #2: " . testReadWrite() . "
";

echo "Read/write #3: " . testReadWrite() . "
";

echo "CPU speed #1: " . testCpuSpeed() . "
";

echo "CPU speed #2: " . testCpuSpeed() . "
";

echo "CPU speed #3: " . testCpuSpeed() . "
";

?>

我的PC结果:

>读/写: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

我的一个服务器的结果(作为空闲的计算机几乎像我的电脑,但有点快):

>读/写:0.088 / 0.168 / 0.185

> CPU速度:0.191 / 0.189 / 0.189

所以我不认为这是因为我的电脑速度,但我敢肯定有另一个问题。

你有在Windows 7(或Vista)XAMPP速度的一些经验吗?

谢谢。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值