### C Example: TinyFastCGI Application Structure Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ap_guide.htm Illustrates the basic structure of a minimal FastCGI application in C, including necessary includes and the main function setup. ```c #include #include int main (int argc, char **argv) { int count = 0; // TODO: Initialize application state here // Main FastCGI loop while (FCGI_Accept() >= 0) { // TODO: Process the request here // For example, print a response: printf("Content-type: text/plain\n\nHello World! Request number %d\n", ++count); } return 0; } ``` -------------------------------- ### Example Authorizer Header Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch1intro.htm Shows a specific example of an authorizer header that sets the AUTH_METHOD environment variable. ```text Variable-AUTH_METHOD: database lookup ``` -------------------------------- ### FastCGI Filter Application Example Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/apaman.htm Example demonstrating how a FastCGI Filter application reads client data, calls FCGI_StartFilterData, and then reads and echoes the filter data. ```c while (FCGI_Accept() >= 0) { ... /* Read data passed by client. */ while (getchar () != OF) { } /* Adjust standard input stream. */ status = FCGI_StartFilterData(); /* Read in filter data and echo it back to client. */ while ((len = fread(tempBuffer, 1, 1024, stdin)) > 0) fwrite(tempBuffer, 1, len, stdout); } /* End FCGI_Accept loop */ ``` -------------------------------- ### TinyFastCGI Example using fcgi_stdio Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch2c.htm A simple 'Hello World' FastCGI application in C using the fcgi_stdio library. It initializes a counter and prints a response for each request. ```c #include "fcgi_stdio.h" /* fcgi library; put it first*/ #include int count; void initialize(void) { count=0; } void main(void) { /* Initialization. */ initialize(); /* Response loop. */ while (FCGI_Accept() >= 0) { printf("Content-type: text/html\r\n" "\r\n" "FastCGI Hello! (C, fcgi_stdio library)" "

FastCGI Hello! (C, fcgi_stdio library)

" "Request number %d running on host %s\n", ++count, getenv("SERVER_HOSTNAME")); } } ``` -------------------------------- ### Tcl FastCGI Hello World Example Source: https://fastcgi-archives.github.io/FastCGI_Developers_Kit_FastCGI.html Demonstrates a basic FastCGI application in Tcl using FCGI_Accept. It handles incoming requests and outputs an HTML page with the request count. ```tcl #!./tclsh set count 0 while {[FCGI_Accept] >= 0 } { incr count puts -nonewline "Content-type: text/html\r\n\r\n" puts "FastCGI Hello! (Tcl)" puts "

FastCGI Hello! (Tcl)

" puts "Request number $count running on host $env(SERVER_NAME)" } ``` -------------------------------- ### Tcl Example: TinyFastCGI Application Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ap_guide.htm A minimal FastCGI application implemented in Tcl, showing the basic structure for handling incoming requests. ```tcl package require fcgi set count 0 while {[fcgi::accept] >= 0} { # Print response header puts "Content-type: text/plain" puts "" # Increment request count and print message incr count puts "Hello World! Request number $count" # Process request if needed # ... } ``` -------------------------------- ### Perl FastCGI Hello World Example Source: https://fastcgi-archives.github.io/FastCGI_Developers_Kit_FastCGI.html Illustrates a basic FastCGI application in Perl using the FCGI module. It accepts requests in a loop and prints a simple HTML response. ```perl #!./perl use FCGI; $count = 0; while(FCGI::accept() >= 0) { print("Content-type: text/html\r\n\r\n", "FastCGI Hello! (Perl)\n", "

FastCGI Hello! (Perl)

\n"; "Request number ", ++$count, " running on host ";$env(SERVER_NAME)"); } ``` -------------------------------- ### Perl Example: TinyFastCGI Application Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ap_guide.htm A basic FastCGI application written in Perl, demonstrating the minimal code required to respond to requests. ```perl use CGI qw(:standard); use FCGI qw(:std); my $count = 0; while (FCGI::accept() >= 0) { # Read environment variables my $request_method = $ENV{'REQUEST_METHOD'}; my $query_string = $ENV{'QUERY_STRING'}; # Print response header print header(-type => 'text/plain'); print "Hello World! Request number ", ++$count, "\n"; # Process request if needed # ... } ``` -------------------------------- ### Java FastCGI Hello World Example Source: https://fastcgi-archives.github.io/FastCGI_Developers_Kit_FastCGI.html A simple FastCGI application written in Java using the FCGIInterface class. It processes requests and returns an HTML response indicating the request number. ```java import FCGIInterface; class TinyFCGI { public static void main (String args[]) { int count = 0; while(new FCGIInterface().FCGIaccept()>= 0) { count ++; System.out.println("Content-type: text/html\r\n\r\n"); System.out.println( "FastCGI Hello! (Java)"); System.out.println("

FastCGI Hello! (Java)

"); System.out.println( "request number " + count + " running on host " + System.getProperty("SERVER_NAME") + ""); } } } ``` -------------------------------- ### Build PHP with FastCGI Support Source: https://fastcgi-archives.github.io/FastCGI_FAQ.html This command configures and builds PHP with FastCGI support. Ensure FastCGI libraries are installed before running this command. ```bash # ./configure --with-fastcgi=/usr/local ``` -------------------------------- ### FastCGI Simple Request Protocol Flow Source: https://fastcgi-archives.github.io/FastCGI_Specification.html Example of a basic FastCGI request with no stdin data and a successful response. Demonstrates FCGI_BEGIN_REQUEST, FCGI_PARAMS, FCGI_STDIN, FCGI_STDOUT, and FCGI_END_REQUEST. ```text {FCGI_BEGIN_REQUEST, 1, {FCGI_RESPONDER, 0}} {FCGI_PARAMS, 1, "\013\002SERVER_PORT80\013\016SERVER_ADDR199.170.183.42 ... "} {FCGI_PARAMS, 1, ""} {FCGI_STDIN, 1, ""} {FCGI_STDOUT, 1, "Content-type: text/html\r\n\r\n\n ... "} {FCGI_STDOUT, 1, ""} {FCGI_END_REQUEST, 1, {0, FCGI_REQUEST_COMPLETE}} ``` -------------------------------- ### Example HTTP Response with Custom Status Source: https://fastcgi-archives.github.io/FastCGI_FAQ.html This example shows the raw HTTP response format that mod_fastcgi expects to see from a CGI script when a custom status code is desired. The 'Status:' header is used by mod_fastcgi to set the HTTP status line. ```http HTTP/1.1 400 Bad Request Date: Thu, 22 Jan 2004 00:25:11 GMT Server: Apache/1.3.26 (Unix) mod_jk mod_fastcgi/cvs AuthMySQL/2.20 mod_ssl/2.8.10 OpenSSL/0.9.6c Connection: close Content-Type: text/html; charset=iso-8859-1 ...data... ``` -------------------------------- ### Example Filter Application Scenario Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch1intro.htm Illustrates how a filter FastCGI application would process a request for a file with a specific MIME type. ```text /www.aerjug.com/docs/chap1.sgml ``` -------------------------------- ### FastCGI Start Filter Data Function Synopsis Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/apaman.htm Synopsis for the FCGI_StartFilterData function, used by FastCGI Filter applications. ```c #include int FCGI_StartFilterData(void) ``` -------------------------------- ### FastCGI Header Termination Example Source: https://fastcgi-archives.github.io/FAQ_Newer_FastCGI.html Demonstrates the correct way to terminate FastCGI headers by including an empty line. This is crucial for the server to correctly interpret the response. ```c printf("Content-type: text/html\r\nStatus: 200 OK\r\n\r\n"); ``` -------------------------------- ### FastCGI Header File Path Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch2c.htm Specifies the include path for the FastCGI header file during compilation. Ensure the toolkit is installed correctly. ```text _$toolkit_/include/fcgi_stdio.h ``` -------------------------------- ### Configure External FastCGI Server within Document Root Source: https://fastcgi-archives.github.io/Apache_FAQ_FastCGI.html This example configures an external FastCGI server using a path within the server's document root. This method can lead to confusion between real and virtual filesystem locations. ```apache FastCGIExternalServer /var/www/htdocs/extprog -host 127.0.0.1:9000 ``` -------------------------------- ### TinyFastCGI Example in Perl Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch3perl.htm A simple, complete FastCGI application written in Perl. It includes the shebang line for a FastCGI-savvy Perl interpreter, the necessary FCGI import, initialization code, and a response loop that generates basic HTML output. ```perl #!fcgi-savvy-perl use FCGI; # Imports the library; required line # Initialization code $cnt = 0; # Response loop while (FCGI::accept >= 0) { print "Content-type: text/html\r\n\r\n"; print "\nFastCGI Demo Page (perl)\n\n"; print "

FastCGI Demo Page (perl)

\n"; print "This is coming from a FastCGI server.\n
\n"; print "Running on $ENV{SERVER_NAME} to $ENV{REMOTE_HOST}\n
\n"; $cnt++; print "This is connection number $cnt\n"; } ``` -------------------------------- ### Perl FastCGI Signal Handling (Aborting on SIGPIPE) Source: https://fastcgi-archives.github.io/Perl_FastCGI.html This example shows how to handle SIGPIPE by aborting the current request and shutting down. This is useful for immediate error response and graceful termination upon client disconnection. ```perl #!/usr/local/bin/perl use strict; use warnings; use FCGI; my $count = 0; my $handling_request = 0; my $exit_requested = 0; my $request = FCGI::Request(); sub sig_handler { $exit_requested = 1; exit(0) if !$handling_request; } $SIG{USR1} = \&sig_handler; $SIG{TERM} = \&sig_handler; $SIG{PIPE} = sub {die 'SIGPIPE\n';}; while ($handling_request = ($request->Accept() >= 0)) { eval {&abort_request;} if (!eval {&do_request; 1;} && $@ ne 'SIGPIPE\n'); $handling_request = 0; last if $exit_requested; } $request->Finish(); exit(0); sub do_request() { print("Content-type: text/html\r\n\r\n", ++$count); $request->Finish(); } sub abort_request() { $exit_requested = 1; # assume the error isn't recoverable print STDERR "fatal error, request aborted, shutting down: $@\n"; $request->Finish(); } ``` -------------------------------- ### C Example: Prime Number Generator Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ap_guide.htm A more complex FastCGI application in C that generates prime numbers. It demonstrates handling requests and performing computations within the FastCGI loop. ```c #include #include #include // Function to check if a number is prime int is_prime(int n) { if (n < 2) return 0; for (int i = 2; i * i <= n; i++) { if (n % i == 0) return 0; } return 1; } int main (int argc, char **argv) { int count = 0; char *prime_str; int max_num = 10000; // Default max number to check // Check for a command-line argument for the maximum number if (argc > 1) { max_num = atoi(argv[1]); } // Main FastCGI loop while (FCGI_Accept() >= 0) { // Get the maximum number from the query string if provided char *query_string = getenv("QUERY_STRING"); if (query_string != NULL && strstr(query_string, "max=") != NULL) { char *max_val_str = strstr(query_string, "max=") + 4; max_num = atoi(max_val_str); } // Generate prime numbers up to max_num char response[1024]; strcpy(response, "Content-type: text/plain\n\nPrimes up to "); strcat(response, itoa(max_num)); strcat(response, ": "); for (int i = 2; i <= max_num; i++) { if (is_prime(i)) { strcat(response, itoa(i)); strcat(response, ", "); } } // Remove trailing comma and space if any primes were found if (strlen(response) > strlen("Primes up to ") + strlen(itoa(max_num)) + 2) { response[strlen(response) - 2] = '\0'; } printf("%s\n", response); count++; } return 0; } ``` -------------------------------- ### Sample FastCGI Makefile Path Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch2c.htm Provides the location of a sample Makefile for building C FastCGI applications. This file contains necessary build rules and path configurations. ```text _$toolkit_/examples/Makefile ``` -------------------------------- ### Simple FastCGI 'Hello World' Application Source: https://fastcgi-archives.github.io/FastCGI_A_High-Performance_Gateway_Interface_FastCGI.html A basic C program demonstrating a FastCGI application that returns a 'Hello world' HTML response and counts requests. It requires the fcgi_stdio.h header for FastCGI routines. ```c #include void main(void) { int count = 0; while(FCGI_Accept() >= 0) { printf("Content-type: text/html\r\n"); printf("\r\n"); printf("Hello world!
\r\n"); printf("Request number %d.", count++); } exit(0); } ``` -------------------------------- ### Configure and Build FastCGI Kit Source: https://fastcgi-archives.github.io/FastCGI_Developers_Kit_FastCGI.html Sequence of commands to configure and build the FastCGI Developer's Kit from its source directory. Ensure you are in the 'fcgi-devel-kit' directory before execution. ```bash % ./configure % make ``` -------------------------------- ### Basic CGI Hello World Program Source: https://fastcgi-archives.github.io/FastCGI_Developers_Kit_FastCGI.html A simple C program demonstrating standard CGI output to stdout and reading environment variables using getenv. This serves as a baseline for comparison with the FastCGI version. ```c #include #include void main(void) { int count = 0; printf("Content-type: text/html\r\n" "\r\n" "CGI Hello!" "

CGI Hello!

" "Request number %d running on host %s\n", ++count, getenv("SERVER_NAME")); } ``` -------------------------------- ### Build FastCGI Applications Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch2c.htm Commands to configure and build FastCGI applications using the provided Makefile. This process sets up the build environment and compiles the applications. ```bash $ ./configure $ make ``` -------------------------------- ### FastCGI Application Structure Source: https://fastcgi-archives.github.io/FastCGI_A_High-Performance_Web_Server_Interface_FastCGI.html Illustrates the basic structure of a FastCGI application, including initialization and the request processing loop. This pattern is essential for handling incoming requests efficiently. ```c _Initialize application_; while(FCGI_Accept() >= 0) { _Process request_; } ``` -------------------------------- ### FCGI_StartFilterData Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/apaman.htm Enables a FastCGI Filter application to begin reading its filter input data from stdin. This function should be called after reading stdin to EOF and positions stdin at the start of FCGI_DATA. ```APIDOC ## FCGI_StartFilterData ### Description Enables a FastCGI Filter application to begin reading its filter input data from `stdin`. This function should be called after the application has been invoked in the filter role and has read `stdin` to EOF. It positions `stdin` at the start of `FCGI_DATA`. ### Synopsis ```c #include int FCGI_StartFilterData(void); ``` ### Return Values - 0: On success. - Negative integer: On failure. ### Example ```c while (FCGI_Accept() >= 0) { /* Read data passed by client. */ while (getchar () != OF) { /* consume data */ } /* Adjust standard input stream. */ status = FCGI_StartFilterData(); /* Read in filter data and echo it back to client. */ while ((len = fread(tempBuffer, 1, 1024, stdin)) > 0) fwrite(tempBuffer, 1, len, stdout); } ``` ``` -------------------------------- ### Configure PHP with FastCGI Source: https://fastcgi-archives.github.io/FastCGI_FAQ.html This snippet demonstrates how to configure Apache to use a FastCGI-enabled PHP binary. It includes directives for setting up the FastCgiServer, defining handlers, and specifying the Action for PHP files. ```apache FastCgiServer /export/httpd/cgi-bin/php AddHandler php-fastcgi .php     SetHandler fastcgi-script Action php-fastcgi /cgi-bin/php DirectoryIndex index.html index.shtml index.cgi index.php AddType application/x-httpd-php .php ``` -------------------------------- ### FastCGI Hello World Program using fcgi_stdio Source: https://fastcgi-archives.github.io/FastCGI_Developers_Kit_FastCGI.html A C program using the fcgi_stdio library to implement a FastCGI application. It continuously accepts requests in a loop, printing dynamic output and incrementing a request counter. ```c #include "fcgi_stdio.h" #include void main(void) { int count = 0; while(FCGI_Accept() >= 0) printf("Content-type: text/html\r\n" "\r\n" "FastCGI Hello!" "

FastCGI Hello!

" "Request number %d running on host %s\n", ++count, getenv("SERVER_NAME")); } ``` -------------------------------- ### Perl FastCGI Auto-Restart on File Change Source: https://fastcgi-archives.github.io/Perl_FastCGI.html This example shows a simple mechanism for automatically restarting a Perl FastCGI application when its script file is modified. It checks the modification time of the SCRIPT_FILENAME environment variable. ```perl while ( $request->Accept() >= 0) { # handle request request->Finish(); exit if -M $ENV{SCRIPT_FILENAME} < 0; # Autorestart } ``` -------------------------------- ### Ruby: Reopening STDIN for FastCGI Server Socket Source: https://fastcgi-archives.github.io/FastCGI_FAQ.html This Ruby snippet demonstrates how to reopen the standard input (STDIN) to listen for FastCGI connections on a TCP server. This is a common method for starting external FastCGI applications. ```ruby require 'socket' STDIN.reopen(TCPServer.new('127.0.0.1',9000)) ``` -------------------------------- ### C FastCGI Prime Number Generator Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch2c.htm This C code implements a FastCGI application that pre-calculates prime numbers using the Sieve of Eratosthenes and serves requests for the n-th prime number. It's efficient for repeated lookups after an initial setup cost. ```c #include "fcgi_stdio.h" #include #include #define POTENTIALLY_PRIME 0 #define COMPOSITE 1 #define VALS_IN_SIEVE_TABLE 1000000 #define MAX_NUMBER_OF_PRIME_NUMBERS 78600 /* All initialized to POTENTIALLY_PRIME */ long int sieve_table[VALS_IN_SIEVE_TABLE]; long int prime_table[MAX_NUMBER_OF_PRIME_NUMBERS]; /* Use Sieve of Erastothenes method of building a prime number table. */ void initialize_prime_table(void) { long int prime_counter=1; long int current_prime=2, c, d; prime_table[prime_counter]=current_prime; while (current_prime < VALS_IN_SIEVE_TABLE) { /* Mark off composite numbers. */ for (c = current_prime; c <= VALS_IN_SIEVE_TABLE; c += current_prime) { sieve_table[c] = COMPOSITE; } /* Find the next prime number. */ for (d=current_prime+1; sieve_table[d] == COMPOSITE; d++); /* Put the new prime number into the table. */ prime_table[++prime_counter]=d; current_prime=d; } } void main(void) { char *query_string; long int n; initialize_prime_table(); while(FCGI_Accept() >= 0) { /* * Produce the necessary HTTP header. */ printf("Content-type: text/html\r\n" "\r\n"); /* * Produce the constant part of the HTML document. */ printf("Prime FastCGI\n" "

Prime FastCGI

\n"); /* * Read the query string and produce the variable part * of the HTML document. */ query_string = getenv("QUERY_STRING"); if(query_string == NULL) { printf("Usage: Specify a positive number in the query string.\n"); } else { query_string = strchr(query_string, `=') + 1; n = strtol(query_string); if(n < 1) { printf("The query string `%s' is not a positive number.\n", query_string); } else if(n > MAX_NUMBER_OF_PRIME_NUMBERS) { printf("The number %d is too large for this program.\n", n); } else printf("The %ldth prime number is %ld.\n", n, prime_table[n]); } } } /* while FCGI_Accept */ } ``` -------------------------------- ### Basic FastCGI Hello World Application in Tcl Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/ch4tcl.htm A minimal FastCGI application in Tcl that responds to requests with a simple HTML page and a request counter. Ensure you are using a FastCGI-savvy Tcl interpreter. ```Tcl #!fcgi-savvy-tcl set count 0 # Response Loop while {[FCGI_Accept] >= 0 } { incr count puts -nonewline "Content-type: text/html\r\n\r\n" puts "FastCGI Hello! (Tcl)" puts "

FastCGI Hello! (Tcl)

" puts "Request number $count running on host $env(SERVER_NAME)" } ``` -------------------------------- ### FastCGI Accept Function Synopsis Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/apaman.htm Synopsis for the FCGI_Accept function and related compatibility macros FCGI_ToFILE and FCGI_ToFcgiStream. ```c #include int FCGI_Accept(void); FILE * FCGI_ToFILE(FCGI_FILE *); FCGI_Stream * FCGI_ToFcgiStream(FCGI_FILE *); ``` -------------------------------- ### Typical httpd.conf for mod_fastcgi Source: https://fastcgi-archives.github.io/Apache_FAQ_FastCGI.html This configuration sets up mod_fastcgi to handle dynamic scripts and defines static FastCGI servers. Ensure ExecCGI is enabled for directories serving dynamic applications. ```apache LoadModule fastcgi_module modules/mod_fastcgi.so # URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/ Alias /fcgi-bin/ /var/www/fcgi-bin/ # Anything in here is handled as a "dynamic" server if not defined as "static" or "external" SetHandler fastcgi-script Options +ExecCGI # Anything with one of these extensions is handled as a "dynamic" server if not defined as # "static" or "external". Note: "dynamic" servers require ExecCGI to be on in their directory. AddHandler fastcgi-script .fcgi .fpl # Start a "static" server at httpd initialization inside the scope of the SetHandler FastCgiServer /var/www/fcgi-bin/echo -processes 5 # Start a "static" server at httpd initialization inside the scope of the AddHandler FastCgiServer /var/www/htdocs/some/path/echo.fcgi # Start a "static" server at httpd initialization outside the scope of the Set/AddHandler FastCgiServer /var/www/htdocs/some/path/coolapp SetHandler fastcgi-script ``` -------------------------------- ### FCGI_Accept Source: https://fastcgi-archives.github.io/fcgi2/doc/fastcgi-prog-guide/apaman.htm Accepts a new request from the HTTP server and creates a CGI-compatible execution environment. It handles both CGI and FastCGI server invocation scenarios, managing environment variables and detecting potential errors. ```APIDOC ## FCGI_Accept ### Description Accepts a new request from the HTTP server and creates a CGI-compatible execution environment for the request. It manages the global variables stdin, stdout, stderr, and environ, and sets FCGI_ROLE. It also handles errors like broken pipes and allows for CGI-like behavior by returning -1 on subsequent calls in CGI mode. ### Synopsis ```c #include int FCGI_Accept(void); ``` ### Return Values - 0: Successful call. - -1: Error (application should exit). ``` -------------------------------- ### Configure Apache to Handle Specific File Extensions as FastCGI Applications Source: https://fastcgi-archives.github.io/mod_fastcgi.html Use the AddHandler directive to configure Apache to treat files with specified extensions as FastCGI applications. Common extensions include fcg, fcgi, and fpl. ```apache AddHandler fcg fcgi fpl ``` -------------------------------- ### FastCGI Request with Stdin Data Protocol Flow Source: https://fastcgi-archives.github.io/FastCGI_Specification.html Illustrates a FastCGI request that includes data sent via FCGI_STDIN. Shows how parameters can be split across multiple FCGI_PARAMS records. ```text {FCGI_BEGIN_REQUEST, 1, {FCGI_RESPONDER, 0}} {FCGI_PARAMS, 1, "\013\002SERVER_PORT80\013\016SER"} {FCGI_PARAMS, 1, "VER_ADDR199.170.183.42 ... "} {FCGI_PARAMS, 1, ""} {FCGI_STDIN, 1, "quantity=100&item=3047936"} {FCGI_STDIN, 1, ""} {FCGI_STDOUT, 1, "Content-type: text/html\r\n\r\n\n ... "} {FCGI_STDOUT, 1, ""} {FCGI_END_REQUEST, 1, {0, FCGI_REQUEST_COMPLETE}} ``` -------------------------------- ### Configure Apache for PHP FastCGI Source: https://fastcgi-archives.github.io/PHP_FastCGI.html These directives in httpd.conf set up Apache to pass .php requests to the FastCGI server and enable index.php as a directory index. ```apache FastCgiServer /export/httpd/cgi-bin/php AddHandler php-fastcgi .php SetHandler fastcgi-script Action php-fastcgi /cgi-bin/php DirectoryIndex index.html index.shtml index.cgi index.php AddType application/x-httpd-php .php ```