I'm running XAMPP 1.7.1 on Windows 7 Ultimate. Everything (Apache & MySQL) is working fine except for speed.
When I open http://localhost/, I must wait probably 1-3 seconds for view a webpage. In my opinion, it should be at most some hundreds miliseconds.
Basic facts:
I've made a little simple benchmark PHP script to test HDD/CSS speeds:
<?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>"; ?>
My PC results:
A webhosting results:
One of my server's results (as idle computer nearly as my PC, but a little bit faster):
So I don't think that it is because of my PC speed, but I'm sure that there's some another problem. Do you have some experience with XAMPP speed on Windows 7 (or Vista) ?
Thanks.
The 'taking too long to respond' error indicates that there is a communication problem between the target server and the client (your web browser). It means that the targeted server is taking a long time to send a response to the client. The error is usually sent if the client cannot get a response within 30 seconds.
Doing a development on windows using XAMPP with default install on windows can give you a nightmares due to its dead slow speed of processing. I too had same issue of slow processing speed on XAMPP. XAMPP loads a lot of stuff you often don't need. I personally use docker virtualized webservers or run it in a linux vm.
If XAMP is slow under windows 7, the firewall settings make no difference.
The Security Essentials anti-virus makes no difference.
To solve this problem, the two things that make a big difference are:
1) in windows\system32\drivers\etc\hosts add the following lines:
127.0.0.1 127.0.0.1
127.0.0.1 localhost
2) If you're using PHP, in the XAMP php.ini file uncomment the eaccelerator line:
zend_extension = "C:\xampp\php\ext\php_eaccelerator_ts.dll"
After these two changes, restart Apache and it will be way faster.
Not sure this might be the cause of your problems, but this might be an idea : do you have a line that looks like this :
::1 localhost
in your hosts (it should be somewhere like C:\WINDOWS\system32\drivers\etc\hosts
, if I remember correctly) file ?
If yes, comment that line by adding a #
at the beginning.
This way, the only line that's about localhost should be
127.0.0.1 localhost
which is an IPv4 address ; and the one you commented being an IPv6 -- which is quite not useful for what you are trying to do.
As I said, not sure your problem is related to this, but I've seen this sugestion help a couple of times for problems quite similar to your (i.e. waiting a long time before doing anything on the server).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With