Very Slow Apache on Windows 7

The simplest script:

<?php echo 'hello'; 

It takes about 3 seconds. Apache seems to be waiting a long time until it serves the web page.

I tried disabling antivirus by disabling ipv6 and more, but Apache is still very slow. What should I do?

EDIT:

Additional Information:

  • Apache 2.2
  • PHP 5.2
  • These are only dynamic PHP files. Static files (html) are served instantly
  • This has nothing to do with system specifications, this is a new PC.

There are several PHP notifications in the Apache error log:

 [Thu Jul 01 08:37:21 2010] [error] [client 127.0.0.1] PHP Notice: Undefined variable: ref in D:\\data\\o\\WebProjects\\elearning\\application\\modules\\clientarea\\controllers\\ViewController.php on line 578, referer: http://elearning/clientarea/view/course/teid/1/cid/1 
+4
source share
7 answers

It was usually suggested that this problem was caused by the intervention of your firewall or the inclusion of IPv6 on your network interfaces, however these solutions did not help me solve this problem. It turns out that by default the Windows 7 hosts file in the folder "C: \ Windows \ System32 \ drivers \ etc \ hosts" commented out this line:

 # 127.0.0.1 localhost 

In my case, just uncommenting this line changed the performance of the local host to what it should have been, instead of annoying 3-5 seconds of waiting on each page load. Remember that you need to run a text editor with administrator privileges in order to edit the hosts file.

+11
source

I had the same problem. Modifying the host file did not improve page loading speed. After searching for the watch, I finally found a solution.

I changed my httpd.conf file so that the listening address is bound to a single IP address instead of all the available interfaces:

 #Listen 80 Listen 127.0.0.1:80 

Now all web pages load instantly, rather than ~ 10 seconds.

I hope for this help.

Edit: this did not actually solve the problem, but still was randomly slow. I must admit that I finally moved my web server to the Linux virtual machine, on which I no longer observed any slow response time.

+3
source

I am using the Laravel Framework, what worked for me is changing the realpath_cache_size = 1M directive in php.ini. This changed the boot time from 3 seconds to half a second!

realpath_cache_size = 1M

+1
source

In my case, by default, the standard root files C:\PathToApache\htdocs were transferred to other users on the local network. By disabling shared access to this directory, I improved the performance of Apache. Now each request takes less than a minute.

Hope this helps all of you in the future.

0
source

To help anyone who faces this Apache dilemma slow on Windows, I solved this by commenting out ::1 localhost in C:\Windows\System32\drivers\etc\hosts and adding 127.0.0.1 127.0.0.1 .

It seemed to me that I had to restart Apache in Windows Services because my websites would respond more slowly and more slowly.

The Apache htdocs folder was not split, changing the Listen ... in httpd.conf did not seem to work, and I already had the 127.0.0.1 localhost line in my C:\Windows\System32\drivers\etc\hosts file, but ::1 localhost was directly below it.

As @Erwinus recommends in my comment on the top post, I commented on this line and from this post I added the line 127.0.0.1 127.0.0.1 . It seems that server response time has improved significantly.

0
source

The only thing that helped me was to uncheck the "Register these connection addresses in dns" checkbox in the ipv4 settings of the network adapter, the button in the DNS settings → the bottom two checkboxes.

0
source

Use the task manager to kill unnecessary processes.

By the way, you should end the script in ?> .

-8
source

Source: https://habr.com/ru/post/1314202/


All Articles