How to install PHP as FastCGI under Apache on Windows 10

by Dani Arlandis — on  ,  , 

FastCGI is a binary protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests per same amount of time. More info..

1. Download PHP Non Thread Safe version at http://windows.php.net/download, once downloaded install Apache, instructions here: httpd.apache.org/docs/2.4/platform/windows.html

2. Download "mod_fcgid" from the Apachelounge site.

You can find it in the Apache modules section https://www.apachelounge.com/download 64 bits mod_fcgid-2.3.9-win64-VC15.zip or 32 bits mod_fcgid-2.3.9-win32-VC15.zip

Unzip and copy mod_fcgid.so to Apache/modules folder

3. Add the following options in httpd.conf:

Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper c:/apache/php/php-cgi.exe .php

4 Add these options at the end of httpd.conf:

LoadModule fcgid_module modules/mod_fcgid.so
FcgidInitialEnv PHPRC "C:/Apache/php"

5. Restart Apache service and FastCgi is already activated.

Bonus

If you want increase timeout for fast cgi proccess add follows lines at the end of httpd.conf

FcgidIOTimeout 3000
FcgidBusyTimeout 3000