windows - Apache is not responding during expensive PHP operation


My problem is that while I'm rebuilding the cache (a very longfor loop) in my PHP localhost website, Apache stops responding completely - if I open any page on my site, it will be loading as long as cache is rebuilding, which might take an hour (it's not very well optimised but that's beside the point). When the cache is ready and no expensive operation is being performed, everything opens just fine. It seems like there's only a single thread running, so when a single script is being executed for a long time, nothing else can be opened.

I'm using XAMPP (Apache, PHP) on Windows 7. Apache is configured to use WinNT MPM. Here's a relevant part of config file:

# ThreadsPerChild: constant number of worker threads in the server process
# MaxConnectionsPerChild: maximum number of connections a server process serves
<IfModule mpm_winnt_module>
    ThreadsPerChild        150
    MaxConnectionsPerChild   0

I'm obviously not running into 150 thread limit, the expensive operation I'm talking about is a single longfor loop executed in a single script, so it should be taking just a single thread.

Here's what a process structure for Apache looks like:


Only two processes, an idle parent and a child that performs the operation. Maybe there's a way to make Apache increase the amount of processes it creates for PHP? Any ideas on how this can be debugged?

Also, please, note that the problem only exists on localhost, it works fine on a production server, i.e. it can render other pages while the cache rebuilding is in the progress, so I know that it has something to do with the configuration.

People are also looking for solutions to the problem: php - Wordpress Multisite with localhost and 8090 port


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.