home > notes > fcgi [ printer-friendly version ]
Git
SSH and scp
FCGI config
8 page book
Animal Crossing
AOL Images
automount
baked beans
Bass Guitar
AOL main.idx
Crash IE
Ham Radio
Disk Hog
Dual Heads
favicon.ico
FireFox prefetch
Highway Hacking
ISO images
Chip's Challenge
ladder
lunch
mmencode
PHOENIX
PostScript
Powershell
prtdiag
rsync
samba
sims cheats
Sim Tower hack
Solaris USB
spray cans
SSI Banners
HTML Symbols
ToolTalk error
vistium
CDE Wallpaper
Windows 7 Password

How to fix FCGI after ASO breaks it

FastCGI is an amazing performance enhancement for Perl scripts on an Apache web server - but the FCGI module has to be part of the Apache environment, and it requires a configuration setting in your Apache config file. A Small Orange supports FCGI and it works very well, but occasionally they step on your config file and FCGI stops working properly - and the Web support staff just does not know how to resolve this issue, apparently.

Here's the .htaccess config file (located in my public_html directory) that correctly handles .fcgi scripts. The interesting line is line 3, where the fcgid-script process is associated with .fcgi files:

RewriteEngine on
AddHandler cgi-script .pl .cgi
AddHandler fcgid-script .fcgi

AddHandler server-parsed .html
RewriteCond %{HTTP_HOST} ^okbanlon.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.okbanlon.com$
RewriteRule ^mesa/?$ http://okbanlon.com/mesa/cgi-bin/index.fcgi [R=301,L]

AddHandler cgi-script .pm

RewriteCond %{HTTP_REFERER} !^http://okbanlon.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://okbanlon.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.okbanlon.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.okbanlon.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

AddType text/x-script.sh .sh

Line 2 ( AddHandler cgi-script .pl .cgi ) is the generic normal config line that handles plain CGI processing for .pl and .cgi scripts.

Line 3 ( AddHandler fcgid-script .fcgi ) is the line that invokes actual FCGI processing for .fcgi scripts. The fcgid-script handler is baked into the Apache runtime environment, but you have to explain to Apache that you want to use it for your .fcgi scripts.

So - the next time your FCGI scripts either stop working altogether (typically displaying the source code instead of executing the scripts) or stop working properly (running a fresh thread instance on every execution instead of preserving the thread instance for increased performance on subsequent executions), try fixing the problem yourself before contacting the support team.


home Always know when it's time to get out of Dodge. privacy