SSI Commands

This page lists SSI commands and provides a brief description of what they do. SSI Commands are specified using the following syntax:


The <!-- and the --> brackets must be included.

The commands are as follows:

CommandParameterArgument TypeFunction
#configermsgmessageSets the server error message to the string "message"
sizefmtformat The value format is "abbrev" or "bytes". This configures the output of the #fsize command to show file size in bytes or kilobytes(abbrev).
timefmtstringControls how date and time are displayed. Format of the string is described on a later page.
#echovarenvironment variableEcho the environment variable value.
#execcmdExecutable file nameExecute the specified program.
cgiCGI file nameExecute the specified CGI program.
#flastmodfilefile nameTells the last time the named file was modified
#fsizefilefile nameTells the file size of the named file.
#includefilefile namePuts the contents of the named file inside the current file.
virtualfile nameThe path to the file is relative to the web server root directory.

Additional SSI Variables

In addition to the available CGI variables, SSI adds the following additional environment variables:

  • DATE_GMT - The present date and time in Greenwich Mean Time.
  • DATE_LOCAL - The current local time zone date and time.
  • DOCUMENT_NAME - The web page file being displayed such as an HTML file.
  • DOCUMENT_URL - Relative to the web server root path, this is the virtual path to the file.
  • LAST_MODIFIED - The date and time of the last modification of the current file.
  • QUERY_STRING_UNESCAPED - The undecoded query string, including a backward slash (\) followed by some special characters.

These environment variables may be used with the echo command to output the information contained by the environment variables. They may also be used in the server script that is called by the #EXEC command to add more functionality on the server side. I use this to save a hit count value in the server script program to a different file for every web page it is called from based on the name of the .SHTML file the SSI command is in. This way only one script program is required to record hit counts and all that is required beyond that is to put the #EXEC command on each page you want to record hits for.