FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue [Answered]RSS

8 replies

Last post Jul 26, 2013 12:57 AM by Jiageng Dong - MSFT

  • FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 22, 2013 08:50 AM|MuscleJunkie|LINK

    Some changes have been made over the past couple of weeks that have made additional use of WinCache that has resulted in significant improvements to the site's response time.  But now, it seems that PHP with FastCGI is becoming a bit unstable and we are seeing intermittent 503 Server overloaded errors.

    We are running this on Server 2k3 - IIS6

    The fastcgiext.ini reads as follows


    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000
    ActivityTimeout=700
    IdleTimeout=120
    RequestTimeout=900
    InstanceMaxRequests=10000
    MaxInstances=0
    SignalBeforeTerminateSeconds=10
    StderrMode=IgnoreAndReturn200

    Prior to the improvements - this setup was stable for a considerable time - now not sure where to begin in determining the problems with the 503 server overloaded messages.

  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 22, 2013 05:06 PM|MuscleJunkie|LINK

    Well after some more trial and error - these changes seemed to have stabilized things - just not sure why.  Hopefully one of the IIS - FCGI folks can offer some input

    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:50000
    ActivityTimeout=700
    IdleTimeout=120
    RequestTimeout=900
    InstanceMaxRequests=50000
    MaxInstances=0
    SignalBeforeTerminateSeconds=120
    StderrMode=IgnoreAndReturn200
    FlushNamedPipe=1

  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 23, 2013 11:11 PM|Jiageng Dong - MSFT|LINK

    Hi MuscleJunkie,

    Thanks for posting!

     

    MuscleJunkie

    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:50000

    MuscleJunkie

    InstanceMaxRequests=50000

    “PHP_FCGI_MAX_REQUESTS” environment variable definition so that php-cgi.exe doesn't recycle itself, maybe your other setting in the iis caused it to reset fastcgi, such as w3wp.exe (single worker app pool) is set to restart once per day..

    If your webserver has a large volume of requests, I suggest you can use distributed architecture.

    About distributed architecture, you can refer to this link:

    http://www.webdbtips.com/184101/

    Aslo we can use Application Request Routing(ARR) to achieve load balancing of HTTP server requests, refer to this link:

    http://www.iis.net/downloads/microsoft/application-request-routing

    If you want to get more detail about the fastcgi setting, Please refer to this link:

    http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/configuring-the-fastcgi-extension-for-iis-60

    Thanks!

    Please mark the replies as answers if they help or unmark if not.
    Feedback to us
  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 24, 2013 01:30 AM|MuscleJunkie|LINK

    Thank You for the reply Jiageng.  I would look at your 1st link.

    We did end up having to make another change to fcgiext.ini as it seems after a period of time all the php-cgi processes would lock up for a minute or so.  With this change, it seems it solved that issue - but again not sure why it was doing this in the 1st place.

    EnvironmentVars=PHP_FCGI_MAX_REQUESTS:50000
    ActivityTimeout=700
    IdleTimeout=120
    RequestTimeout=900
    InstanceMaxRequests=50000
    MaxInstances=0
    SignalBeforeTerminateSeconds=45
    StderrMode=IgnoreAndReturn200
    FlushNamedPipe=1

    We did confirm that the serving application pool had all items turned off with the exception of pinging every 120 seconds.  No automatic recycling was turn on.

    I've previously seen your fcgi settings link - but unfortunately it did not help us in determining why these errors were occuring in the 1st place and what proper settings would be applicable for our application.  Alot of this was determined with simple trial and error.  The server does receive a high volume of requests but now with the settings above it seems to be very stable once again at this new traffic level.  When the crashes were occuring, no error were popping up in the php error log or the syslog so this means we have no idea what the problems were caused by.

  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 24, 2013 03:22 AM|Jiageng Dong - MSFT|LINK

    Hello,

    Thanks for your post!

    MuscleJunkie

    When the crashes were occuring, no error were popping up in the php error log or the syslog so this means we have no idea what the problems were caused by.

    Please check your php.ini, we need to modify the property 'display_errors='  into 'On' so that we can get the error message on the page.

    And also we can change the property 'memory_limit'.

    However I think a lot of concurrent requsets cause the crashes of php-cgi.exe,so firstly we can improve the efficiency of memory.

    We can use eAccelerator to improve our website  as the following link:

    http://eaccelerator.net/

    Aslo we can use Application Request Routing(ARR) to achieve load balancing of HTTP server requests, refer to this link:

    http://www.iis.net/downloads/microsoft/application-request-routing

    Please try it, hope it helpful for your problem.

    Thanks!

    Please mark the replies as answers if they help or unmark if not.
    Feedback to us
  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 24, 2013 10:25 AM|MuscleJunkie|LINK

    Jiageng,

    Thank you once again for your reply.  We currently have PHP logging turned on and set to log to a file as it is not too good of an idea to display errors on a "live" site.  We've tried to enable logging to the syslog but even when we cause php errors that would show when logged to a file is enabled - they do not show up in the syslog.  Not quite sure why this is.  But we are positive logging to a file works correctly except that we were experience the previously described fastcgi crashes - nothing is logged in the php errors log.

    We currently have a larger memory limit set in our php.ini as well - but wanted to ask what was the recommended setting here and would this contribute to fastcgi crashes if it were set too low/incorrectly?

    As for eAccelerator - we instead are using WinCache - http://www.iis.net/downloads/microsoft/wincache-extension

    Thank You

  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 25, 2013 04:54 AM|Jiageng Dong - MSFT|LINK

    Hello,

    Thanks for your post!

    As we know, when webserver received the httprequest, webserver will send the cgi environment variables and standard input into the php-cgi, after php-cgi finished processing, it will return to the webserver with the standard output and  error messages from the same connection. So when the php-cgi crashes were occuring, our syslog can not receive the original error messages.

    About the recommended setting of php.ini, actually, if php workprocess always occurs error, our php-cgi will increase response time and handle more exception..

    For your case, we need to improve the efficiency of php code running, and we will monitor our memory usage,

    The following link is about how to monitor our memory usage,maybe helpful..

    http://technet.microsoft.com/en-us/sysinternals/ff700229

    About better to  improve the server load, we are in survey, if you have a good idea, hope you can share your solutions and experience.

    Thanks!

    Please mark the replies as answers if they help or unmark if not.
    Feedback to us
  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 25, 2013 10:46 AM|MuscleJunkie|LINK

    Thanks Jiageng,

    The app link you supplied is only for Vista and higher.  We are running Server 2k3

  • Re: FastCGI on PHP 5.2.17 - with WinCache 1.1.0630.0 - 503 Server Overloaded issue

    Jul 26, 2013 12:57 AM|Jiageng Dong - MSFT|LINK

    Hello,

    I'm sorry for that link, if you runing server 2003, we can use manageEngine to monitor our server to ensure the CPU Utilization, Memory, Disk , Bandwidth consumed by the servers are at optimal limits.

    The following link is about detail of manageEngine:

    http://www.manageengine.com/free-windows-health-monitor/windows-monitoring-tool.html

    Hope it can help you!

    Thanks!

    Please mark the replies as answers if they help or unmark if not.
    Feedback to us