Zero logo

Fast CGI using Apache module mod_fcgid

All pre-configured ZeroXI servers have PHP installed as an Apache module. An alternative is to install and run PHP as fast CGI using Apache module mod_fcgid. This page covers updating a pre-configured ZeroXI server to run PHP as fast cgi in addition provides a step-by-step guide to creating a bespoke server using the available modules.

Updating a pre-configured ZeroXI server to run PHP as fast cgi

To update a pre-configured ZeroXI server to run PHP as fast cgi proceed as follows:

  1. If running, stop Uniform Server (Apache and MySQL) from UniController
  2. If running, exit UniController.
  3. Download lastest version of fcgi module ZeroXI_apache_fcgid_2_3_9_b.exe
  4. Save to folder UniServerZ.
  5. Double click on the above installation file. This runs the self-extracting archive.
  6. If prompted allow overwriting of existing files.
  7. If you wish; delete the installation file, it is no longer required.
  1. If they exist delete the following folders :
    • \UniServerZ\core\php52
    • \UniServerZ\core\php53
    • \UniServerZ\core\php54
    • \UniServerZ\core\php55
    • \UniServerZ\core\php56
    • \UniServerZ\core\php70
  2. Download modules you require. Download one or all of the following PHP version (use latest version):
    • ZeroXI_php_nts_5_2_17.exe
    • ZeroXI_php_nts_5_3_29.exe
    • ZeroXI_php_nts_5_4_35.exe
    • ZeroXI_php_nts_5_5_19.exe
    • ZeroXI_php_nts_5_6_3.exe
    • ZeroXI_php_nts_7_0_0_dev.exe
  3. Save to folder UniServerZ.
  4. For each of the above double click on the installation file. This runs the self-extracting archive.
    • If prompted allow overwriting of existing files.
    • If you wish; delete the installation file, it is no longer required.

Note: Each plugin contains a read-me file providing any additional instructions this is located in folder UniServerZ.

Bespoke server to run PHP as fast cgi

The following provides a complete guide for installing a WAMP (Windows Apache MySQL and PHP) server running PHP as fast cgi. Installing is a misnomer! Nothing is installed to your PCs registry all files are extracted to their appropriate location within the UniServer folder structure.

To install a WAMP server proceed as follows:

  1. Download and save the latest controller file (ZeroXI_Controller_1_1_8.exe from the Default list) to drive c:
  2. The file is a self-extracting archive, double click on above file to run the extractor.
  3. A new folder C:\UniServerZ is created containing the controller application UniController.exe and support folders and files.
  1. Download and save the latest Apache plugin file (ZeroXI_apache_2_4_10_3.exe from the Default list) to folder UniServerZ
  2. The file is a self-extracting archive, double click on above file to run the extractor.
  1. Download the following plugins (or latest version) and save to folder UniServerZ.
    • ZeroXI_apache_fcgid_2_3_9_b.exe - Apache mod_fcgid.so + httpd.conf (Use module from the Alternative list)
    • ZeroXI_mysql_5_5_41.exe - MySQL server (Use module from the Default list)
    • ZeroXI_php_nts_5_4_35.exe - PHP (Use PHP modules from the Alternative list)
    • ZerXI_phpmyadmin_4_2_11.exe - Admin for MySQL server (Use module from the Default list)
  2. For each of the above installation files double click to run the extractor.
  3. If prompted allow overwriting of existing files.
  4. If you wish; delete the installation files, they are no longer required.

Note: Each plugin contains a read-me file providing any additional instructions this is located in folder UniServerZ.

Configuration notes

Note 1: The module ZeroXI_apache_fcgid_2_3_9_b.exe overwrites the configuration file UniServerZ\core\apache2\conf\httpd.conf and adds mod_fcgid.so to the Apache modules folder UniServerZ\core\apache2\modules

Note 2: Parameters in configuration file UniServerZ\core\apache2\conf\httpd.conf

Load module

LoadModule fcgid_module modules/mod_fcgid.so

Common fcgid module configuration parameters

<IfModule fcgid_module>
 FcgidInitialEnv SystemRoot "C:/Windows"
 FcgidInitialEnv SystemDrive "C:"
 FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
 FcgidInitialEnv TMP "C:/WINDOWS/Temp"
 FcgidInitialEnv US_ROOTF "${US_ROOTF}"
 FcgidInitialEnv windir "C:/WINDOWS"
 FcgidIOTimeout 64
 FcgidConnectTimeout 16
 FcgidMaxRequestsPerProcess 1000 
 FcgidMaxProcesses 50 
 FcgidMaxRequestLen 8131072
 FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
</IfModule>

PHP selection is provided by IfDefine directives.

<IfDefine php52>
 FcgidInitialEnv PATH "${US_ROOTF}/core/php52;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
 FcgidInitialEnv PHPRC "${US_ROOTF}/core/php52/${PHP_INI_SELECT}"

 <Files ~ "\.php$>"
  AddHandler fcgid-script .php
  FcgidWrapper "${US_ROOTF}/core/php52/php-cgi.exe" .php
 </Files>
</IfDefine>

<IfDefine php53>
.....etc
</IfDefine>

<IfDefine php54>
.....etc
</IfDefine>

<IfDefine php55>
.....etc
</IfDefine>

<IfDefine php56>
 .....etc
</IfDefine>

<IfDefine php70>
 FcgidInitialEnv PATH "${US_ROOTF}/core/php70;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
 FcgidInitialEnv PHPRC "${US_ROOTF}/core/php70/${PHP_INI_SELECT}"

 <Files ~ "\.php$>"
  AddHandler fcgid-script .php
  FcgidWrapper "${US_ROOTF}/core/php70/php-cgi.exe" .php
 </Files>
</IfDefine>

Note 3: The above Apache configuration is intended to get you quickly up and running with fast cgi.
You will need to tweak configuration parameters to suit your specific requirements.
For a complete list of directives refer to following page http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html


--oOo--