= mod_fcgid =
 * https://httpd.apache.org/mod_fcgid/
mod_fcgid is a high performance alternative to mod_cgi or mod_cgid, which starts a sufficient number instances of the CGI program to handle concurrent requests, and these programs remain running to handle further incoming requests. 

{{{#!highlight bash
wget http://mirrors.up.pt/pub/apache//httpd/mod_fcgid/mod_fcgid-2.3.9.tar.bz2
tar xvif mod_fcgid-2.3.9.tar.bz2 
cd mod_fcgid-2.3.9
./configure.apxs 
make
make install
/usr/lib/httpd/modules/mod_fcgid.so
# /etc/httpd/httpd.conf
# LoadModule fcgid_module lib/httpd/modules/mod_fcgid.so
}}}

== fcgi library ==
 * https://opensource.apple.com/source/FastCGI/FastCGI-4/fcgi/doc/fastcgi-whitepaper/fastcgi.htm
{{{#!highlight bash
cd /tmp/
wget https://slackbuilds.org/slackbuilds/14.2/libraries/fcgi.tar.gz
tar xvzf fcgi.tar.gz 
cd fcgi
wget https://sourceforge.net/projects/slackbuildsdirectlinks/files/fcgi/fcgi-2.4.0.tar.gz
./fcgi.SlackBuild 
installpkg  /tmp/fcgi-2.4.0-i486-1_SBo.tgz
}}}

== fcgi_app.c ==
{{{#!highlight c
/*compile:  cc fcgi_app.c -o fcgi_app -lfcgi */
/* /usr/lib/libfcgi.so */
/* cp /tmp/fcgi_app /var/www/htdocs/localhostfcgi/app.fcgi */

#include <fcgi_stdio.h>
void main(void)
{
    int count = 0;
    while(FCGI_Accept() >= 0) {
        printf("Content-type: text/html\r\n");
        printf("\r\n");
        printf("Hello world!<br>\r\n");
        printf("Request number %d.", count++);
    }
    exit(0);
}
}}}

== /etc/httpd/vhosts.conf ==
 * http://localhostfcgi/app.fcgi
{{{
<VirtualHost *:80>
    ServerName localhostfcgi
    FcgidInitialEnv name value 
    DocumentRoot "/var/www/htdocs/localhostfcgi"
    ScriptAlias / /var/www/htdocs/localhostfcgi/
    <Directory "/var/www/htdocs/localhostfcgi">
        Options +ExecCGI
        Require local
    </Directory>
</VirtualHost>
}}}

== /etc/httpd/httpd.conf ==
{{{
LoadModule fcgid_module lib/httpd/modules/mod_fcgid.so
SetHandler fcgid-script
Options +ExecCGI
}}}

{{{
lsof | grep -i fcgi
app.fcgi  9803          apache    0u     unix 0xe1dff440      0t0      59138 /var/run/fcgidsock/4840.1 type=STREAM
}}}