0

On a Windows Server 2016 Standard with IIS 10.0 I am experiencing serious problems with the IIS application pool hanging for a PHP site written in YII, making the site unresponsive until the pool is restarted. I write hanging because the pool isn't stopped as per the IIS manager. In the beginning it happened only now and then so I just restarted the application pool manually. Then it got worse so I wrote a powershell script to monitor the site and restart the pool when it didn't respond. Lately it has escalated so it now hangs many times a day, and furthermore it turns out that the unresponsiveness is "selective" in that the site often isn't down locally (using the normal url, not localhost), making the script not perform its job.

It is not only locally the unresponsiveness seems selective. For example, it can be down for me, but not for downforeveryoneorjustme.com etc. Then, how can I know that the application pool is the culprit and not some network problems? Because when I restart the pool, it works again everywhere - until it doesn't.

What's also peculiar is that there is a sister site which is almost identical, only the skin is different. Same YII code, same database etc. Just showing other types of products. And that site rarely (less than once a month) experience the application pool problem.

The site doesn't get much traffic and there is nothing suspicious in the IIS log. NO DDOS type attacks etc, only the usual SQL injection attempts now and then, and they don't coincide with the application pool going down. I am logging Failed Requests but nothing shows up that can explain the problem either. Likewise with the Event log, there are nothing special around the times for the site becoming unresponsive.

I have tried switching pipeline mode for the application pool without any success.

The reason for running PHP in IIS is that there is also a classic ASP site on the server. Otherwise I would simply use Apache. And if I don't find the cause of the problem, I might use Apache anyway and set up a proxy for the ASP site.

But I still hope to find the root cause so this annoying problem can be fixed!

Please advice.

6
  • You will have to step further to see what exactly hangs when the problem occurs, the IIS worker process or PHP FastCGI process, docs.lextudio.com/blog/… Without that, there won’t be meaningful discussions. You didn’t indicate the version of PHP either, but older versions are known to be deprecated or have performance issues. Commented Jan 16 at 16:13
  • are you noticing any error when your site or app pool hangs? What is your iis site app pool recycling setting? Is it possible for you to add the application logging to see if there is any issue in the code? could you try to do DNS flush if you are only facing on the selected machine by running ipconfig /flushdns command on affected resource and see the result. While you are facing the issue what is the memory and CPU usage at that time? You could try to use the tool to capture dump logs and analyze that. Try disabling rapid failed protection for test purpose and observe the behavior. Commented Jan 17 at 9:29
  • @LexLi Your comment and your blog lead me in the right direction. After reading your blog, I realized that the problem actually wasn't caused by the application pool hanging as I had thought, but rather the PHP process itself. The problem was correctly caused by an old PHP version as suggested in your comment. The site was old (running PHP 5.3) and wasn't compatible with newer PHP versions. So I took the time to upgrade the site and changed to PHP 7.2, and so far the site has been running smoothly for 3 days. If you write your comment as an answer, I will mark it as Accepted. Thanks! Commented Jan 19 at 13:11
  • @JalpaPanchal No, I didn't see and errors when the app hanged. Memory and CPU usage was normal. But see my note to Lex li. Commented Jan 19 at 13:11
  • Just out of curiosity: why is my question downvoted? It there is something wrong with it, it would be more helpful to let me know how to improve it :) Commented Jan 19 at 13:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.