no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | apache_fcgid [2015/06/01 21:34] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Apache fcgid ====== | ||
+ | * [[Apache]] | ||
+ | * [[Apache suExec]] | ||
+ | * [[apxs]] | ||
+ | * [[AMP Stack]] | ||
+ | * [[PHP CGI]] | ||
+ | |||
+ | * [[http:// | ||
+ | |||
+ | Any program assigned to the handler fcgid-script is processed using the FastCGI protocoll; '' | ||
+ | |||
+ | 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). | ||
+ | |||
+ | ==== PHP ==== | ||
+ | |||
+ | PHP applications are usually configured using the '' | ||
+ | |||
+ | ==== Apache Installation ==== | ||
+ | |||
+ | The only variable that needs to be set during installation is APXS. By default it will look at ''/ | ||
+ | |||
+ | < | ||
+ | APXS=/ | ||
+ | make | ||
+ | make install | ||
+ | </ | ||
+ | |||
+ | ==== Apache Configuration ==== | ||
+ | |||
+ | First, make sure that mod_fcgid is loaded | ||
+ | |||
+ | < | ||
+ | < | ||
+ | LoadModule fcgid_module modules/ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | After creating the PHP wrapper script to the '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | AddHandler fcgid-script .php | ||
+ | FcgidWrapper / | ||
+ | < | ||
+ | SetHandler fcgid-script | ||
+ | Options +ExecCGI | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | For a VirtualHost entry, it must also have the '' | ||
+ | |||
+ | < | ||
+ | < | ||
+ | ServerName qa.beandog.org | ||
+ | DocumentRoot "/ | ||
+ | < | ||
+ | Options +ExecCGI | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | # FcgidMaxRequestsPerProcess should be <= PHP_FCGI_MAX_REQUESTS | ||
+ | # The example PHP wrapper script overrides the default PHP setting. | ||
+ | # Default PHP_FCGI_MAX_REQUESTS is 500 | ||
+ | # FcgidMaxRequestsPerProcess 10000 | ||
+ | |||
+ | # Uncomment the following line if cgi.fix_pathinfo is set to 1 in | ||
+ | # php.ini: | ||
+ | # Default cgi.fix_pathinfo is 1 | ||
+ | FcgidFixPathinfo 1 | ||
+ | |||
+ | Alias /phpapp/ / | ||
+ | < | ||
+ | AddHandler fcgid-script .php | ||
+ | Options +ExecCGI | ||
+ | FcgidWrapper / | ||
+ | |||
+ | # Customize the next two directives for your requirements. | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | == Sample PHP Wrapper Script == | ||
+ | |||
+ | < | ||
+ | #!/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 / | ||
+ | </ | ||
+ | |||
+ | ==== Setup CGI User Environment ==== | ||
+ | |||
+ | * Create ''/ | ||
+ | * Create a new user '' | ||
+ | * Home directory: ''/ | ||
+ | * Shell: ''/ | ||
+ | * No login allowed | ||
+ | * New group with same name as user | ||
+ | * User ID >= 1000 | ||
+ | * Group ID >= 1000 | ||
+ | * Don't copy skeleton files | ||
+ | |||
+ | ==== Timeout ==== | ||
+ | |||
+ | By default, CGI requests time out at 40 seconds. | ||
+ | '' | ||
+ | |||
+ | < | ||
+ | FcgidIOTimeout 90 | ||
+ | </ |