SSI.cgi 1.8

A standalone SSI (Server Side Includes) interpreter

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!
send us
an update
GPL (GNU General Public License) 
3.4/5 14
Remy Horton
ROOT \ Internet \ HTTP (WWW)
SSI.cgi is a standalone SSI (Server Side Includes) interpreter, intended for use with lightweight webservers (such as Cherokee) that themselves do not support SSI. SSI.cgi script is implemented using C, with the intention of minimizing both overheads and dependency requirements.

The project started when I was considering possible alternatives to Apache, the webserver I have used in the past for both my own websites and those I have setup for other people. I came across Cherokee, which seemed to offer a good balance between being lightweight (in particular, ease of setup) and features that are useful. In particular its ability to run scripts under different Unix users didn't require the awkward setting up that suexec and suPHP needed.

The big problem is that my more recent sites used SSI to avoid duplicating common page components such as headers. Although one possibility was to convert the sites to use PHP instead, this was not something I wanted to do. I also didn't want to use Perl, which was required by the SSI parsers I came across on the web. In the end I decided to write my own parser, and SSI.cgi was the result.

Supported directives

include - Include a file


Included file is relative to the filesystem directory of current file.


Included file is relative to the document root on the filesystem. Some SSI documents state this is the behaviour of the virtual parameter.


Included file is relative to URL of the document. This will trigger a fetch request to the server, so the included files will need to be HTTP-accessible, at least for requests originating from the system hosting SSI.cgi. This approach is required as SSI.cgi is unaware of URL-to-filesystem mappings that may be in force on the server.

echo - Display a parameter (or enviornment variable)


Name of variable to print. Multiple var parameters may be included


Encoding to use when printing variable. The encoding affects all var= parameter between itself and either the next encoding parameter or the end of the echo command. Valid choices are none, url (encode for use in links), and entity (encode using HTML escape codes). Default is entity encoding.

flastmod - Display datestamp of file




fsize - Display file size




printenv - Print all enviornment (if enabled) and user variables.

set - Set user variable


Name of variable to set


What to set the variable to

config - Set SSI configuration options

sizefmt - Format for displaying file sizes with fsize

Choice of bytes (default) which prints the exact size in bytes, and abbrev which postfixes the numbers with K, M or G if the files are in the kilobyte/megabyte/gigabyte region.

errmsg - SSI error message

Default is There was an error processing this directive

timefmt - Format for flastmod timestamps

Uses strftime for time formatting. Default is %d/%m/%Y %H:%M%:%.

echomsg - Placeholder for undefined variables

Shown when echo is used with a nonexistant variable. Defaault is undefined

if - Conditional statement


Conditional expression. It follow

elif - Conditional statement (else if)


Conditional expression

else - Conditional statement

endif - Conditional statement


- cURL - Required to support the virtual parameter.
- POSIX Threads - Required for FastCGI

Last updated on July 26th, 2009

#Server Side Includes #SSI interpreter #SSI support #SSI #interpreter #Cherokee #CGI

Add your review!