Configuring IIS Timeouts

The following instructions are intended for running Zend Server with PHP FastCGI on Windows.

Issue:

The default timeout settings for FastCGI, may cause runtime failures for scripts that run longer than 30 seconds.

Resolution:

If you know that you have scripts that run more than 30 seconds set your FastCGI and PHP to a longer script timeout duration.

FastCGI Settings:

This procedure describes how to change your FastCGI timeout settings according to webserver type and version.

  • IIS 7:
    In applicationHost.config locate the following:

        <fastCgi>

            <application fullPath="C:\Program Files (x86)\Zend\ZendServer\bin\php-cgi.exe" maxInstances="10" instanceMaxRequests="10000" >

                <environmentVariables>

                    <environmentVariable name="PHPRC" value="C:\Program Files (x86)\Zend\ZendServer\etc" />

                    <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />

                </environmentVariables>

            </application>

        </fastCgi>

  • And change the following values:
    activityTimeout="<Number of Seconds>"
    requestTimeout="<Number of Seconds>"

PHP Settings

This procedure describes how to configure your PHP's execution time.

 

 

Instructions on how to complete a procedure

To configure your PHP's execution time:

  1. In Zend Server go to Configurations | PHP.
  1. In the Search box, enter 'resource', and press Enter.
  2. From the Extensions List, select Resource Limits and Tuning, and modify the value for the following directives:
  1. Edit the value of the following directives:
  • Change max_execution_time to <Number of Seconds>
  • Change max_input_time to<Number of Seconds>
  1. Click .
  2. In the toolbar, the restart icon lights up , indicating a restart is needed to apply changes. Click to restart server and apply changes.
    For information on restarting in Zend Server, see Server Restart.

Scripts that run more than 30 seconds but less than <Number of Seconds> should now run. See below for instructions on how to test this.

Testing the Changes

The following procedure shows how to run a short script that checks if the settings have been properly applied.

 

 

Instructions on how to complete a procedure

To test your settings:

  1. Open a text editor and insert the following code:

<?php

sleep(40);

echo "If you see this text the script completed and the defaults were changed";.

?>

  1. Run the script from your docroot, if the script suceeded to run you will see the following message in your browser "If you see this text the script completed and the defaults were changed"

If the test failed you will not see a message in your browser. In that case try restarting your webserver and running the script again.