Mason FastCGI
From DreamHost
Contents |
FastCGI Instructions
- Setup the CPAN module.
- Run: cpan -i CGI::Fast BSD::Resource
- Grab mason.fcgi and place it in the document root of your website. (Make sure it's named mason.fcgi.)
- The mason.fcgi script must be executable. The script and the containing directory must be group-writable by your default unix group:
(chgrp `groups | awk '{print $1}'` . mason.fcgi ; chmod 775 . mason.fcgi )
- Grab .htaccess and place it in any directory on your website that you want to be run through Mason. (Make sure it's named .htaccess.)
- To try the script out from the commandline you should do "./mason.fcgi" If you want to run manually with perl, make sure you pass -T.
CGI Instructions
- Follow the FastCGI Instructions above
- Rename mason.fcgi to mason.cgi
- Edit the .htaccess to change its reference to mason.fcgi to mason.cgi
Things to be aware of
This script will create a mason/SITENAME directory off of your home directory and place the Mason runtime files there.
Advantages of this method
- This handler requires no setup other then putting it in place.
- It automatically includes the path to the modules you've installed via CPAN.
- It puts in process limits to stop your script from impacting other people from the script if a bug causes it to leak memory or enter an infinite loop.
- It runs under taint mode so that it's more difficult to accidentally use untrusted (user provided) information in unsafe ways.
- It turns on HTML escaping by default in Mason which will significantly reduce the chance of creating a site vulnerable to XSS attacks. You can still output stuff without HTML escaping with the "n" flag, eg <% $stuff |n %>.
- Works with both CGI and FastCGI in one script.
Disadvantages of this method
- Does no forking. It'd be nice to get a nice pre-forking FastCGI handler for Perl.

