My problem is that while I'm rebuilding the cache (a very long for
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:
# WinNT MPM
# 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
</IfModule>
I'm obviously not running into 150 thread limit, the expensive operation I'm talking about is a single long for
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.