Limit the number of php-cgi.exe that run per website on IIS 7

iis-7php-cgiphp5windows-server-2008-r2

I wasn't sure which was best to post in so I posted here and on http://webmasters.stackexchange.com

I will delete the other if this post is more relevant here.

I'm having a slight issue with memory issues on my web server. It is Windows 2008 RC2 IIS 7.5 with Fast CGI installed and running, all up to date.

I have a number of WordPress websites running on this server, yet they do not all run at the same time; server load/traffic is not that high at the moment.

However when some of them run, even if it just me on the site, they spawn multiple php-cgi.exe instances to handle my "surfing".

Some points to note:

  • I have Hyper Cache installed on each WordPress site, and seems to be working fine.
  • I understand that the PHP-CGI.exe instances only stay alive for as long as required.

For example: one WordPress website with pretty much no content and minimal plugins (Hyper Cache and Google Analytics) spawn:

  • The w3wp.exe instance and levels out around 10MB
  • 5 x php-cgi.exe which are each roughly 9MB

That amounts to 55-60MB at first run. It seems a bit extreme to me. Another site is pretty much the same at first boot but spawns 8 x php-cgi.exe instances. To put it another way, I would expect this usage from ASP.NET not PHP.

Can I limit the php-cgi.exe to one instance per website and have it handle all requests for that website?

Another point I should mention, I am running PHP 5.2.17. If I upgrade to PHP 5.3.* will this problem go away? (Not that won't break some sites but I can live with that)

Would my only solution to be move them to a Linux box or will I have the same issues doing so?

Thanks for your time and help.

Best Answer

Set the maxInstances of the system.webServer/fastCgi/application section of your configuration to the desired number of fastCGI processes you'll want to allow per application pool (not per website).