Apache HTTP Server Version 2.4

Apache > HTTP Server > Documentation > Version 2.4 > Modules

# Apache Module mod_fcgid

Available Languages: en

Description: | Provides for execution of FastCGI applications
Status: | External
Module Identifier: | fcgid_module
Source File: | mod_fcgid.c
Compatibility: | Apache 2.0 and higher

### Summary

Any program assigned to the handler `fcgid-script` is processed using the FastCGI protocol; `mod_fcgid` starts a sufficient number instances of the program to handle concurrent requests, and these programs remain running to handle further incoming requests. This is significantly faster than using the default `mod_cgi` or `mod_cgid` modules to launch the program upon each request. However, the programs invoked by `mod_fcgid` continue to consume resources, so the administrator must weigh the impact of invoking a particular program once per request against the resources required to leave a sufficient number of instances running continuously.

The pool of fcgid-invoked programs is shared between all httpd workers. Configuration directives below let the administrator tune the number of instances of the program that will run concurrently.

Specific executables are assigned this handler either by having a name containing an extension defined by the `AddHandler` directive, or with an override using the `SetHandler` directive (e.g., for all files in a specific directory such as cgi-bin).

Some changes have been made in the ASF release of mod_fcgid which can affect existing configurations. All documentation refers to new names for the directives. (The old names still work but are now deprecated.) Please read the Upgrade Notes for details.

For an introduction to using CGI scripts with Apache, see the generic tutorial on Dynamic Content With CGI.

### Directives

### Topics

- Upgrade Notes
- Examples
- Process Management

### See also

- Dynamic Content With CGI
- `mod_cgi`
- `mod_cgid`

## Upgrade Notes

The following changes have been made in the ASF release of mod_fcgid and should be considered when upgrading from the original version by Ryan Pan (Pan Qingfeng).

- All directives have been renamed in order to use a common prefix "Fcgid". Underscores in directive names have been eliminated in favor of CamelCase. The old directive names will still work but are deprecated. To fix your configuration you can use the sed script build/fixconf.sed. The following table contains old and new directive names:

  Old Name | New Name
  --- | ---
  `BusyScanInterval` | `FcgidBusyScanInterval`
  `BusyTimeout` | `FcgidBusyTimeout`
  `DefaultInitEnv` | `FcgidInitialEnv`
  `DefaultMaxClassProcessCount` | `FcgidMaxProcessesPerClass`
  `DefaultMinClassProcessCount` | `FcgidMinProcessesPerClass`
  `ErrorScanInterval` | `FcgidErrorScanInterval`
  `FastCgiAccessChecker` | `FcgidAccessChecker`
  `FastCgiAccessCheckerAuthoritative` | `FcgidAccessCheckerAuthoritative`
  `FastCgiAuthenticator` | `FcgidAuthenticator`
  `FastCgiAuthenticatorAuthoritative` | `FcgidAuthenticatorAuthoritative`
  `FastCgiAuthorizer` | `FcgidAuthorizer`
  `FastCgiAuthorizerAuthoritative` | `FcgidAuthorizerAuthoritative`
  `FCGIWrapper` | `FcgidWrapper`
  `IdleScanInterval` | `FcgidIdleScanInterval`
  `IdleTimeout` | `FcgidIdleTimeout`
  `IPCCommTimeout` | `FcgidIOTimeout`
  `IPCConnectTimeout` | `FcgidConnectTimeout`
  `MaxProcessCount` | `FcgidMaxProcesses`
  `MaxRequestInMem` | `FcgidMaxRequestInMem`
  `MaxRequestLen` | `FcgidMaxRequestLen`
  `MaxRequestsPerProcess` | `FcgidMaxRequestsPerProcess`
  `OutputBufferSize` | `FcgidOutputBufferSize`
  `PassHeader` | `FcgidPassHeader`
  `PHP_Fix_Pathinfo_Enable` | `FcgidFixPathinfo`
  `ProcessLifeTime` | `FcgidProcessLifeTime`
  `SharememPath` | `FcgidProcessTableFile`
  `SocketPath` | `FcgidIPCDir`
  `SpawnScore` | `FcgidSpawnScore`
  `SpawnScoreUpLimit` | `FcgidSpawnScoreUpLimit`
  `TerminationScore` | `FcgidTerminationScore`
  `TimeScore` | `FcgidTimeScore`
  `ZombieScanInterval` | `FcgidZombieScanInterval`

## Examples

### Note

The examples assume that mod_fcgid and other necessary modules are loaded into the server already, either built-in or via the `LoadModule` directive.

Additionally, the example configurations provide full access to the applications using access control directives which work with Apache 2.0 and 2.2. These directives are not appropriate for all environments, and they do not work for development levels of Apache HTTP Server (Subversion trunk).

The first example is a very simple Perl FastCGI application, and its configuration directives. This is typical for FastCGI applications which require no special configuration.

### Perl FastCGI application - /usr/local/apache/fcgi-bin/foo.pl

`#!/usr/bin/perl
use CGI::Fast;
while (my $q = CGI::Fast->new) {
print("Content-Type: text/plain\n\n");
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
}
`

### Configuration directives

`<Directory /usr/local/apache/fcgi-bin/>
SetHandler fcgid-script
Options +ExecCGI
# Customize the next two directives for your requirements.
Order allow,deny
Allow from all
</Directory>
`

PHP applications are usually configured using the `FcgidWrapper` directive and a corresponding wrapper script. The wrapper script can be an appropriate place to define any environment variables required by the application, such as `PHP_FCGI_MAX_REQUESTS` or anything else. (Environment variables can also be set with `FcgidInitialEnv`, but they then apply to all applications.)

Here is an example that uses a wrapper script to invoke PHP:

### PHP application - /usr/local/phpapp/phpinfo.php

`<?php
phpinfo();
?>
`

### Configuration directives

`# FcgidMaxRequestsPerProcess should be <= PHP_FCGI_MAX_REQUESTS
# The example PHP wrapper script overrides the default PHP setting.
FcgidMaxRequestsPerProcess 10000
# Uncomment the following line if cgi.fix_pathinfo is set to 1 in
# php.ini:
# FcgidFixPathinfo 1
Alias /phpapp/ /usr/local/phpapp/
<Location /phpapp/>
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /usr/local/bin/php-wrapper .php
# Customize the next two directives for your requirements.
Order allow,deny
Allow from all
</Location>
`

### PHP wrapper script - /usr/local/bin/php-wrapper

`#!/bin/sh
# Set desired PHP_FCGI_* environment variables.
# Example:
# PHP FastCGI processes exit after 500 requests by default.
PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS
# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/local/bin/php-cgi
`

### Special PHP considerations

By default, PHP FastCGI processes exit after handling 500 requests, and they may exit after this module has already connected to the application and sent the next request. When that occurs, an error will be logged and `500 Internal Server Error` will be returned to the client. This PHP behavior can be disabled by setting `PHP_FCGI_MAX_REQUESTS` to 0, but that can be a problem if the PHP application leaks resources. Alternatively, `PHP_FCGI_MAX_REQUESTS` can be set to a much higher value than the default to reduce the frequency of this problem. `FcgidMaxRequestsPerProcess` can be set to a value less than or equal to `PHP_FCGI_MAX_REQUESTS` to resolve the problem.

PHP child process management (`PHP_FCGI_CHILDREN`) should always be disabled with mod_fcgid, which will only route one request at a time to application processes it has spawned; thus, any child processes created by PHP will not be used effectively. (Additionally, the PHP child processes may not be terminated properly.) By default, and with the environment variable setting `PHP_FCGI_CHILDREN=0`, PHP child process management is disabled.

The popular APC opcode cache for PHP cannot share a cache between PHP FastCGI processes unless PHP manages the child processes. Thus, the effectiveness of the cache is limited with mod_fcgid; concurrent PHP requests will use different opcode caches.

## Process Management

mod_fcgid has several types of controls which affect the creation of additional application processes:

Type of control | Directive
--- | ---
global limit on number of processes | `FcgidMaxProcesses`
limit on number of processes per application | `FcgidMaxProcessesPerClass`
limit on rate of spawning new application processes | `FcgidSpawnScoreUpLimit` and other score-related directives

mod_fcgid has several types of controls which affect the termination of existing application processes:

Type of control | Directive
--- | ---
termination after an idle period | `FcgidIdleTimeout`
termination after it handles a certain number of requests | `FcgidMaxRequestsPerProcess`
termination after a certain lifetime | `FcgidProcessLifetime`

Several of the directives control processing for a process class. A process class is the set of processes which were started with the same executable file and share certain other characteristics such as virtual host and identity. Two commands which are links to or otherwise refer to the same executable file share the same process class.

### Note

Certain settings or other concepts that depend on the virtual host, such as `FcgidInitialEnv` or process classes, distinguish between virtual hosts only if they have distinct server names. (See the `ServerName` documentation for more information.) In the case of `FcgidInitialEnv`, if two virtual hosts have the same server name but different environments as defined by `FcgidInitialEnv`, the environment used for a particular request will be that defined for the virtual host of the request that caused the FastCGI process to be started.

Information about each process will be displayed in the `mod_status` server-status page.

## FcgidAccessChecker Directive

Description: | full path to FastCGI access checker
Syntax: | `FcgidAccessChecker command`
Default: | `none`
Context: | directory, .htaccess
Override: | FileInfo
Status: | External
Module: | mod_fcgid

Access checking or, more formally, access control, is a procedure which verifies that the client is allowed to access a resource, using some mechanism other than authentication and authorization.

Key environment variables passed to the application for access checking are:

`FCGI_APACHE_ROLE`
  set to `ACCESS_CHECKER`; by checking the current role, the same FastCGI application can handle multiple stages of request processing

The application must output a `Status` line to indicate the result of the check.

### Warning

Before 2.3.6, only one FastCGI application of any type (AAA or handler) can be used for a particular request URI. Otherwise, the wrong FastCGI application may be invoked for one or more phases of request processing.

## FcgidAccessCheckerAuthoritative Directive

Description: | Set to 'off' to allow access control to be passed along to lower modules upon failure
Syntax: | `FcgidAccessCheckerAuthoritative On|Off`
Default: | `FcgidAccessCheckerAuthoritative On`
Context: | directory, .htaccess
Override: | FileInfo
Status: | External
Module: | mod_fcgid

This directive controls whether or not other access checkers are allowed to run when this module has an access checker configured and it fails a request. If this directive is `On` (default) and a FastCGI access checker returns a failure status, a failure is returned to the client without giving other access checkers a chance to allow access. If this directive is `Off`, other access checkers will be called.

## FcgidAuthenticator Directive

Description: | full path to FastCGI authenticator
Syntax: | `FcgidAuthenticator command`
Default: | `none`
Context: | directory, .htaccess
Override: | FileInfo
Status: | External
Module: | mod_fcgid

Authentication is the procedure which verifies that the user is who they claim they are. This directive specifies the full path to a FastCGI application which will handle authentication for a particular context, such as a directory.

Key environment variables passed to the application on authentication are:

`REMOTE_USER`
  set to the user id of the client
`REMOTE_PASSWD`
  set to the plain text password provided by the client
`FCGI_APACHE_ROLE`
  set to `AUTHENTICATOR`; by checking the current role, the same FastCGI application can handle multiple stages of request processing

The application must output a `Status` line to indicate the result of authentication.

### Warning

Before 2.3.6, only one FastCGI application of any type (AAA or handler) can be used for a particular request URI. Otherwise, the wrong FastCGI application may be invoked for one or more phases of request processing.

## FcgidAuthenticatorAuthoritative Directive

Description: | Set to 'off' to allow authentication to be passed along to lower modules upon failure
Syntax: | `FcgidAuthenticatorAuthoritative On|Off`
Default: | `FcgidAuthenticatorAuthoritative On`
Context: | directory, .htaccess
Override: | FileInfo
Status: | External
Module: | mod_fcgid

This directive controls whether or not other authenticators are allowed to run when this module has an authenticator configured and it fails a request. If this directive is `On` (default) and a FastCGI authenticator returns a failure status, a failure is returned to the client without giving other authenticators a chance to validate the client identity. If this directive is `Off`, other authenticators will be called.

## FcgidAuthorizer Directive

Description: | full path to FastCGI authorizer
Syntax: | `FcgidAuthorizer command`
Default: | `none`
Context: | directory, .htaccess
Override: | FileInfo
Status: | External
Module: | mod_fcgid

Authorization is the procedure which verifies that the user is allowed to access a particular resource. This directive specifies the full path to a FastCGI application which will handle authorization for a particular context, such as a directory.

Key environment variables passed to the application on authorization are:

`REMOTE_USER`
  set to the user id of the client, which has already been authenticated
`FCGI_APACHE_ROLE`
  set to `AUTHORIZER`; by checking the current role, the same FastCGI application can handle multiple stages of request processing

The application must output a `Status` line to indicate the result of authorization.

### Warning

Before 2.3.6, only one FastCGI application of any type (AAA or handler) can be used for a particular request URI. Otherwise, the wrong FastCGI application may be invoked for one or more phases of request processing.

## FcgidAuthorizerAuthoritative Directive

Description: | Set to 'off' to allow authorization to be passed along to lower modules upon failure
Syntax: | `FcgidAuthorizerAuthoritative On|Off`
Default: | `FcgidAuthorizerAuthoritative On`
Context: | directory, .htaccess
Override: | FileInfo
Status: | External
Module: | mod_fcgid

This directive controls whether or not other authorizers are allowed to run when this module has an authorizer configured and it fails a request. If this directive is `On` (default) and a FastCGI authorizer returns a failure status, a failure is returned to the client without giving other authorizer a chance to access the resource. If this directive is `Off`, other authorizers will be called.

## FcgidBusyScanInterval Directive

Description: | scan interval for busy timeout process
Syntax: | `FcgidBusyScanInterval seconds`
Default: | `FcgidBusyScanInterval 120`
Context: | server config
Status: | External
Module: | mod_fcgid

The module performs the `FcgidBusyTimeout` check at this interval.

## FcgidBusyTimeout Directive

Description: | a FastCGI application will be killed after handling a request for FcgidBusyTimeout
Syntax: | `FcgidBusyTimeout seconds`
Default: | `FcgidBusyTimeout 300`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This is the maximum time limit for request handling. If a FastCGI request does not complete within FcgidBusyTimeout seconds, it will be subject to termination. Because the check is performed at the interval defined by `FcgidBusyScanInterval`, request handling may be allowed to proceed for a longer period of time.

The purpose of this directive is to terminate hung applications. The default timeout may need to be increased for applications that can take longer to process the request.

## FcgidCmdOptions Directive

Description: | Set processing options for a FastCGI command
Syntax: | `FcgidCmdOptions command option [option] ...`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This directive allows processing options to be specified for a specific command spawned by mod_fcgid. Each option for the command corresponds to another directive that normally applies to all commands started within a particular context. If a particular option is not specified on this directive, the default will be used.

The following table provides a list of options and corresponding directives:

Option name and syntax | Corresponding directive
--- | ---
`ConnectTimeout seconds` | `FcgidConnectTimeout`
`IdleTimeout seconds` | `FcgidIdleTimeout`
`InitialEnv name[=value]` | `FcgidInitialEnv`
`IOTimeout seconds` | `FcgidIOTimeout`
`MaxProcesses value` | `FcgidMaxProcessesPerClass`
`MaxProcessLifeTime seconds` | `FcgidProcessLifeTime`
`MaxRequestsPerProcess value` | `FcgidMaxRequestsPerProcess`
`MinProcesses value` | `FcgidMinProcessesPerClass`

Multiple environment variables are defined by repeating the `InitialEnv` option.

### Example

`FcgidCmdOptions /usr/local/bin/wrapper \
InitialEnv MAX_REQUESTS=2000 \
MaxRequestsPerProcess 2000 \
IOTimeout 90
`

When `/usr/local/bin/wrapper` is spawned, its initial environment contains the `MAX_REQUESTS=2000` environment variable setting; additionally, mod_fcgid will terminate it after it has handled 2000 requests, and I/O operations will time out after 90 seconds. Directives corresponding to other options, such as `FcgidIdleTimeout` or `FcgidProcessLifeTime`, will be ignored for this command; defaults will be used for options not specified on `FcgidCmdOptions`.

## FcgidConnectTimeout Directive

Description: | Connect timeout to FastCGI server
Syntax: | `FcgidConnectTimeout seconds`
Default: | `FcgidConnectTimeout 3`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This is the maximum period of time the module will wait while trying to connect to a FastCGI application on Windows. (This directive is not respected on Unix, where AF_UNIX defaults will apply.)

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidErrorScanInterval Directive

Description: | scan interval for exited process
Syntax: | `FcgidErrorScanInterval seconds`
Default: | `FcgidErrorScanInterval 3`
Context: | server config
Status: | External
Module: | mod_fcgid

This is the interval at which the module will handle pending process termination. Termination is pending for any processes which have exceeded `FcgidIdleTimeout` or `FcgidProcessLifeTime`.

Unix: mod_fcgid will terminate such processes with SIGTERM; if the process is still active during the next scan, the process will be terminated with SIGKILL. Thus, this directive controls the amount of time for orderly process terminate before being forcibly killed.

## FcgidFixPathinfo Directive

Description: | Mirror the PHP `cgi.fix_pathinfo` setting
Syntax: | `FcgidFixPathinfo 1`
Default: | `FcgidFixPathinfo 0`
Context: | server config
Status: | External
Module: | mod_fcgid

This directive enables special `SCRIPT_NAME` processing which allows PHP to provide additional path information. The setting of `FcgidFixPathinfo` should mirror the `cgi.fix_pathinfo` setting in `php.ini`.

## FcgidIdleScanInterval Directive

Description: | scan interval for idle timeout process
Syntax: | `FcgidIdleScanInterval seconds`
Default: | `FcgidIdleScanInterval 120`
Context: | server config
Status: | External
Module: | mod_fcgid

This is the interval at which the module will search for processes which have exceeded `FcgidIdleTimeout` or `FcgidProcessLifeTime`.

## FcgidIdleTimeout Directive

Description: | An idle FastCGI application will be killed after FcgidIdleTimeout
Syntax: | `FcgidIdleTimeout seconds`
Default: | `FcgidIdleTimeout 300`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

Application processes which have not handled a request for this period of time will be terminated, if the number of processses for the class exceeds `FcgidMinProcessesPerClass`. A value of `0` disables the check.

This idle timeout check is performed at the frequency of the configured `FcgidIdleScanInterval`.

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidInitialEnv Directive

Description: | an environment variable name and optional value to pass to FastCGI.
Syntax: | `FcgidInitialEnv name [ value ]`
Default: | `none`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

Use `FcgidInitialEnv` to define environment variables to pass to the FastCGI application. This directive can be used multiple times.

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidIOTimeout Directive

Description: | Communication timeout to FastCGI server
Syntax: | `FcgidIOTimeout seconds`
Default: | `FcgidIOTimeout 40`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This is the maximum period of time the module will wait while trying to read from or write to a FastCGI application.

### Note

The FastCGI application must begin generating the response within this period of time. Increase this directive as necessary to handle applications which take a relatively long period of time to respond.

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidIPCDir Directive

Description: | directory for AF_UNIX sockets (Unix) or pipes (Windows)
Syntax: | `FcgidIPCDir pathname`
Default: | `FcgidIPCDir logs/fcgidsock`
Context: | server config
Status: | External
Module: | mod_fcgid

This module uses AF_UNIX sockets or named pipes, depending on the platform, to communicate with FastCGI applications. This directive specifies the directory where those sockets or named pipes will be created.

## FcgidMaxProcesses Directive

Description: | maximum number of FastCGI application processes
Syntax: | `FcgidMaxProcesses value`
Default: | `FcgidMaxProcesses 1000`
Context: | server config
Status: | External
Module: | mod_fcgid

This directive sets the maximum number of FastCGI application processes which can be active at one time.

## FcgidMaxProcessesPerClass Directive

Description: | Max process count of one class of FastCGI application
Syntax: | `FcgidMaxProcessesPerClass value`
Default: | `FcgidMaxProcessesPerClass 100`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This directive sets the maximum number of processes that can be started for each process class.

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidMaxRequestInMem Directive

Description: | maximum size of a request which will be held in memory
Syntax: | `FcgidMaxRequestInMem bytes`
Default: | `FcgidMaxRequestInMem 65536`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This module reads the entire request body from the client before sending it to the application. Normally the request body will be stored in memory. Once the amount of request body read from the client exceeds `FcgidMaxRequestInMem` bytes, the remainder of the request body will be stored in a temporary file.

## FcgidMaxRequestLen Directive

Description: | maximum HTTP request length
Syntax: | `FcgidMaxRequestLen bytes`
Default: | `FcgidMaxRequestLen 131072`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

If the size of the request body exceeds this amount, the request will fail with `500 Server Error`.

Administrators should change this to an appropriate value for their site based on application requirements.

### Warning

Before 2.3.6, this defaulted to 1GB. Most users of earlier versions should use this directive to set a more reasonable limit.

### See also

- `FcgidMaxRequestInMem`

## FcgidMaxRequestsPerProcess Directive

Description: | Max requests handled by each FastCGI application
Syntax: | `FcgidMaxRequestsPerProcess value`
Default: | `FcgidMaxRequestsPerProcess 0`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

FastCGI application processes will be terminated after handling the specified number of requests. A value of `0` disables the check.

### Note

A value of `-1` is currently accepted for ease of migration for existing configurations. It is treated the same as `0`.

Certain applications, notably PHP as FastCGI, have their own facility for terminating after handling a certain number of requests. This directive can be used to avoid sending additional requests to the application after it has handled its limit.

### Note

If this is set such that frequent process creation will be required, you will likely need to adjust `FcgidSpawnScoreUpLimit` or other score-related directives to allow more frequent process creation.

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidMinProcessesPerClass Directive

Description: | Min process count of one class of FastCGI application
Syntax: | `FcgidMinProcessesPerClass value`
Default: | `FcgidMinProcessesPerClass 3`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This directive sets the minimum number of processes that will be retained in a process class after finishing requests.

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidOutputBufferSize Directive

Description: | CGI output buffer size
Syntax: | `FcgidOutputBufferSize bytes`
Default: | `FcgidOutputBufferSize 65536`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This is the maximum amount of response data the module will read from the FastCGI application before flushing the data to the client.

## FcgidPassHeader Directive

Description: | Header name which will be passed to FastCGI as environment variable.
Syntax: | `FcgidPassHeader name`
Default: | `none`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

This directive specifies the name of a request header which will be passed to the FastCGI application as an environment variable. The name of the environment variable is derived from the value specified on this directive, as discussed below:

The legacy behavior is to use the value specified on this directive as the environment variable name, converting hyphens to underscores. No case conversion is performed.

Beginning with release 2.3.6, an additional environment variable is created. The value specified on this directive is converted to upper case, prefixed with `HTTP_`, and hyphens are converted to underscores.

### Note

Most request headers are already available to the application as environment variables, and generally are prefixed with `HTTP_`. (Notable exceptions are `Content-type` and `Content-length`, which do not have the `HTTP_` prefix.) Thus, this directive is only required for request headers that are purposefully omitted, such as `Authorization` and `Proxy-Authorization`. Only pass these request headers if absolutely required.

## FcgidProcessLifeTime Directive

Description: | maximum FastCGI application process lifetime
Syntax: | `FcgidProcessLifeTime seconds`
Default: | `FcgidProcessLifeTime 3600`
Context: | server config, virtual host
Status: | External
Module: | mod_fcgid

Idle application processes which have existed for greater than this time will be terminated, if the number of processses for the class exceeds `FcgidMinProcessesPerClass`. A value of `0` disables the check.

This process lifetime check is performed at the frequency of the configured `FcgidIdleScanInterval`.

This setting will apply to all applications spawned for this server or virtual host. Use `FcgidCmdOptions` to apply this setting to a single application.

## FcgidProcessTableFile Directive

Description: | shared memory file path
Syntax: | `FcgidProcessTableFile pathname`
Default: | `FcgidProcessTableFile logs/fcgid_shm`
Context: | server config
Status: | External
Module: | mod_fcgid

This module uses shared memory on Unix to maintain state which is shared between httpd processes. This directive specifies the name of the shared memory file.

## FcgidSpawnScore Directive

Description: | Each spawn adds this value to the process activity score.
Syntax: | `FcgidSpawnScore value`
Default: | `FcgidSpawnScore 1`
Context: | server config
Status: | External
Module: | mod_fcgid

Lower values of this directive increase the allowed spawn rate.

Refer to the `FcgidSpawnScoreUpLimit` directive for more information.

## FcgidSpawnScoreUpLimit Directive

Description: | Maximum value of the process activity score which allows a spawn to occur
Syntax: | `FcgidSpawnScoreUpLimit value`
Default: | `FcgidSpawnScoreUpLimit 10`
Context: | server config
Status: | External
Module: | mod_fcgid

A process activity score is maintained for each FastCGI application; the score is used to control the rate of spawning in order to avoid placing too much load on the system, particularly for applications that are repeatedly exiting abnormally.

The value of `FcgidSpawnScore` is added to the score for every spawned application process. The value of `FcgidTerminationScore` is added to the score for every terminated application process. The value of `FcgidTimeScore` is subtracted from the score every second.

When the current score is higher than the value of `FcgidSpawnScoreUpLimit`, no additional application processes will be spawned; subsequent requests must wait until an existing process is free or until the score decreases below the limit.

If the limit is reached under normal load, it may not be sufficient to simply increase the limit, as that would only delay the amount of time before the limit is reached again. Decrease the value of `FcgidSpawnScore` and/or `FcgidTerminationScore`, or increase the value of `FcgidTimeScore`, to allow a higher rate of spawning.

## FcgidTerminationScore Directive

Description: | Each terminated process adds this value to the process activity score.
Syntax: | `FcgidTerminationScore value`
Default: | `FcgidTerminationScore 2`
Context: | server config
Status: | External
Module: | mod_fcgid

Lower values of this directive increase the allowed spawn rate. Negative values can be useful in some circumstances, such as allowing process replacement without increasing the score.

Refer to the `FcgidSpawnScoreUpLimit` directive for more information.

## FcgidTimeScore Directive

Description: | Amount subtracted from process activity score each second
Syntax: | `FcgidTimeScore value`
Default: | `FcgidTimeScore 1`
Context: | server config
Status: | External
Module: | mod_fcgid

Higher values of this directive increase the allowed spawn rate.

Refer to the `FcgidSpawnScoreUpLimit` directive for more information.

## FcgidWin32PreventOrphans Directive

Description: | Job Control orphan prevention for fcgi workers.
Syntax: | `FcgidWin32PreventOrphans On|Off`
Default: | `FcgidWin32PreventOrphans Off`
Context: | server config
Status: | External
Module: | mod_fcgid

Uses Job Control Objects on Windows, only, to enforce shutdown of all fcgi processes created by the httpd worker when the httpd worker has been terminated. Processes terminated in this way do not have the opportunity to clean up gracefully, complete pending disk writes, or similar closure transactions, therefore this behavior is experimental and disabled, by default.

## FcgidWrapper Directive

Description: | The CGI wrapper setting
Syntax: | `FcgidWrapper command [ suffix ] [ virtual ]`
Default: | `none`
Context: | server config, virtual host, directory, .htaccess
Override: | FileInfo
Status: | External
Module: | mod_fcgid

The given command is used to spawn FCGI server processes. If this directive is not used, the file pointed to by the request URL will be used instead. Options for the command can be included using quotation marks surrounding the command and options.

The optional `suffix` argument restricts the use of this FCGI server to all URLs with the given exact path suffix. A suffix needs to start with '`.`'.

The `virtual` flag signals that there will be no check whether the request URL actually points to an existing file. The only file which needs to exist is the wrapper itself.

The directive can be used multiple times. A wrapper defined without a suffix is used as a default in case no suffix matches.

## FcgidZombieScanInterval Directive

Description: | scan interval for zombie process
Syntax: | `FcgidZombieScanInterval seconds`
Default: | `FcgidZombieScanInterval 3`
Context: | server config
Status: | External
Module: | mod_fcgid

The module checks for exited FastCGI applications at this interval. During this period of time, the application may exist in the process table as a zombie (on Unix).

Available Languages: en