Error 500 if Server-Side Processing Exceeds 5 Seconds - PHP 5.5.10, IIS 7.0, FastCGIRSS

3 replies

Last post Oct 28, 2014 12:48 PM by SuperMJT

  • Error 500 if Server-Side Processing Exceeds 5 Seconds - PHP 5.5.10, IIS 7.0, FastCGI

    Oct 27, 2014 07:05 PM|SuperMJT|LINK

    I'm moving a website off of on old server running Windows Server 2003 Standard (32-bit), IIS 6.0, PHP 5.3.12, and CGI and onto a new server running Windows Server 2008 Standard (32-bit), IIS 7.0, PHP 5.5.10 and FastCGI. 

    On the new server, if a processing step exceeds 5 seconds, the page stops responding and then after the activityTimeout configured in applicationHost.Config an error 500 appears, "The FastCGI process exceeded configured activity timeout".  On the old server, the same processing step takes 29 seconds, but finishes successfully.  The processing step in particular is querying a database to prepare a page of search options.  If I reduce the size of the database table to 400,000 records, the processing step takes 4.91 seconds on the new server and succeeds.  If I increase to 500,000 records, the processing step takes just over 5 seconds and fails.  The entire table is around 880,000 records and will grow a bit through time.

    So, the big question is why does IIS 7.0, PHP 5.5.10, and FastCGI give up after 5 seconds?  If I view the processes tab on the server, I can see that PHP-CGI.exe has one CPU fully occupied for the processing time -- I’ve observed closer to 10 seconds on a longer processing step before PHP-CGI.exe returns to 0 CPU usage.  So, it seems to me that it’s doing the job, but some other 5 second timer out there says “if you don’t talk to me within 5 seconds, I’m going to give up”.  In PHP.ini, max_execution_time is set to 300.

    Thank you in advance for any advice.

  • Re: Error 500 if Server-Side Processing Exceeds 5 Seconds - PHP 5.5.10, IIS 7.0, FastCGI

    Oct 28, 2014 05:18 AM|Pengzhen Song - MSFT|LINK

    Hi,

    I find the default value for connection to mssql is 5s. So try setting a appropriate value for the connection timeout in php.ini

    mssql.connect_timeout = xx

    try setting activityTimout and requestTimeout attribute in applicationhost.config or via iis manger UI( under the server level->FastCGI Settings/Edit.)

    <application fullPath="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" monitorChangesTo="php.ini" activityTimeout="601" requestTimeout="601" instanceMaxRequests="10000">
                    xxxxxxxxxx
    </application>

    In addition, please refer to the similar discussion:

    http://forums.iis.net/t/1150670.aspx?The+FastCGI+process+exceeded+configured+activity+timeout

    We are trying to better understand customer views on social support experience. Click HERE to participate the survey.
    Thanks!
  • Re: Error 500 if Server-Side Processing Exceeds 5 Seconds - PHP 5.5.10, IIS 7.0, FastCGI

    Oct 28, 2014 12:14 PM|SuperMJT|LINK

    Thank you for your response.  I made the change to mssql.connect_timeout in php.ini and confirmed it via phpinfo().  However, the php code is using an ODBC connection to an .MDB file for the query processing, so I guess mssql.connect_timeout does not apply.  I tried to find a similar timeout in php.ini for the ODBC connection, but came up empty.

    phpinfo() reports the following for "Configure Command",

    cscript /nologo configure.js  "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql"

    I also updated applicationhost.config as recommended (the "monitorChangesTo" attribute was not accepted, so I pulled it out).  Before the change, I had "<application fullPath="D:\Program Files\PHP\php-cgi.exe" activityTimeout="30" />".  Now, it's:

            <fastCgi>
                <application fullPath="D:\Program Files\PHP\php-cgi.exe" activityTimeout="60" requestTimeout="60" instanceMaxRequests="10000" />
            </fastCgi>
    

    I've also reviewed the information in the other forum post you provided and I see information therein that will come in handy if I need to configure separate timeout settings for separate sites.  For now, I only have one PHP-based web site on this server, so updating applicationhost.config for server-wide changes is perfect.

    Are there recommendation on how to adjust timeout settings for ODBC connections?  Thanks again.

  • Re: Error 500 if Server-Side Processing Exceeds 5 Seconds - PHP 5.5.10, IIS 7.0, FastCGI

    Oct 28, 2014 12:48 PM|SuperMJT|LINK

    Update:  I also tried using odbc_setoption($result, 2, 0, 30); to set the ODBC timeout, but was unsuccessful in resolving the issue.