[edit] fastcgi_param

Syntax: fastcgi_param parameter value [ if_not_empty ]
Default:
Context: http
server
location
Reference: fastcgi_param


Directive assigns the parameter, which will be transferred to the FastCGI-server.

It is possible to use strings, variables and their combination as values. Directives not set are inherited from the outer level. Directives set in current level clear any previously defined directives for the current level.

Below is an example of the minimally necessary parameters for PHP:

  fastcgi_param  SCRIPT_FILENAME  /home/www/scripts/php$fastcgi_script_name;
  fastcgi_param  QUERY_STRING     $query_string;

Parameter SCRIPT_FILENAME is used by PHP for determining the name of script to execute, and QUERY_STRING contains the parameters of the request.

If dealing with POST requests, then the three additional parameters are necessary. Below is an example of the minimally necessary parameters for PHP:

  fastcgi_param  REQUEST_METHOD   $request_method;
  fastcgi_param  CONTENT_TYPE     $content_type;
  fastcgi_param  CONTENT_LENGTH   $content_length;

If PHP was compiled with --enable-force-cgi-redirect, then it is necessary to transfer parameter REDIRECT_STATUS with the value of "200":

  fastcgi_param  REDIRECT_STATUS  200;

Module: HttpFastcgiModule