Rex Swain's Server-Side Include Demo

Last updated 13 May 2005

View Source Code:
ssidemo.shtml   ssidemo.html   ssidemo.cgi

Note that Netscape calls this facility "Server-Parsed HTML"; Microsoft calls them "Server-Side Includes".

Following is a demonstration of the commands used in server-parsed HTML. These commands are embedded in HTML files. The server replaces each command with data determined by the command and its attributes. The commands are "hidden" within HTML comments so they are ignored if not parsed by the server.

The format for a command is:

   <!--#command attribute1="value1" attribute2="value2" ... -->

For more information, see

Support for SSI varies widely. Some ISPs only allow SSI commands in files with an ".shtml" extension. Some ISPs prohibit certain commands (particularly #exec). Some ISPs don't allow SSI at all. If you control your own server, you can probably turn SSI support on for all files.

<!--#echo var="DATE_LOCAL" -->

Sunday, 22-Oct-2017 14:53:22 MDT

<!--#include virtual="/ssidemo.html" -->

This is HTML code from file ssidemo.html

<!--#include file="ssidemo.html" -->

This is HTML code from file ssidemo.html

<!--#fsize file="ssidemo.html" -->


<!--#flastmod file="ssidemo.html" -->

Wednesday, 19-Jun-2002 00:00:00 MDT

<!--#exec cmd="cgi-bin/" -->

<!--#exec cmd="cgi-bin/ssidemo.cgi" -->

This is Perl output from ssidemo.cgi

<XMP><!--#exec cmd="env" --></XMP>

SERVER_SIGNATURE=<address>Apache/2.0.52 (Red Hat) Server at Port 80</address> LD_PRELOAD= HTTP_USER_AGENT=CCBot/2.0 ( SERVER_PORT=80 DOCUMENT_ROOT=/var/www/html SCRIPT_FILENAME=/var/www/html/ssidemo.shtml REQUEST_URI=/ssidemo.shtml USER_NAME= SCRIPT_NAME=/ssidemo.shtml REMOTE_PORT=59842 PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin PWD=/var/www/html HTTP_IF_MODIFIED_SINCE=Wed, 16 Aug 2017 23:23:15 GMT DATE_GMT= HTTP_ACCEPT=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 DOCUMENT_URI=/ssidemo.shtml DATE_LOCAL=Sunday, 22-Oct-2017 14:53:22 MDT REMOTE_ADDR= SHLVL=1 LAST_MODIFIED= DOCUMENT_NAME=ssidemo.shtml SERVER_SOFTWARE=Apache/2.0.52 (Red Hat) QUERY_STRING= SERVER_ADDR= GATEWAY_INTERFACE=CGI/1.1 SERVER_PROTOCOL=HTTP/1.0 HTTP_ACCEPT_ENCODING=x-gzip, gzip, deflate REQUEST_METHOD=GET _=/bin/env SPHERA_monitor=xxxx SPHERA_service=xxxx SPHERA_pIOr=xx SPHERA_pIOw=x SPHERA_pNETr=x SPHERA_pNETw=x SPHERA_config=x

<XMP><!--#exec cmd="set" --></XMP>

BASH=/bin/sh BASH_ARGC=() BASH_ARGV=() BASH_EXECUTION_STRING=set BASH_LINENO=() BASH_SOURCE=() BASH_VERSINFO=([0]="3" [1]="00" [2]="15" [3]="1" [4]="release" [5]="i686-redhat-linux-gnu") BASH_VERSION='3.00.15(1)-release' DATE_GMT= DATE_LOCAL='Sunday, 22-Oct-2017 14:53:22 MDT' DIRSTACK=() DOCUMENT_NAME=ssidemo.shtml DOCUMENT_ROOT=/var/www/html DOCUMENT_URI=/ssidemo.shtml EUID=2012 GATEWAY_INTERFACE=CGI/1.1 GROUPS=() HOSTTYPE=i686 HTTP_ACCEPT='text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' HTTP_ACCEPT_ENCODING='x-gzip, gzip, deflate' HTTP_IF_MODIFIED_SINCE='Wed, 16 Aug 2017 23:23:15 GMT' HTTP_USER_AGENT='CCBot/2.0 (' IFS=' ' LAST_MODIFIED= LD_PRELOAD= MACHTYPE=i686-redhat-linux-gnu OPTERR=1 OPTIND=1 OSTYPE=linux-gnu PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin POSIXLY_CORRECT=y PPID=5639 PS4='+ ' PWD=/var/www/html QUERY_STRING= REMOTE_ADDR= REMOTE_PORT=59842 REQUEST_METHOD=GET REQUEST_URI=/ssidemo.shtml SCRIPT_FILENAME=/var/www/html/ssidemo.shtml SCRIPT_NAME=/ssidemo.shtml SERVER_ADDR= SERVER_PORT=80 SERVER_PROTOCOL=HTTP/1.0 SERVER_SIGNATURE='<address>Apache/2.0.52 (Red Hat) Server at Port 80</address> ' SERVER_SOFTWARE='Apache/2.0.52 (Red Hat)' SHELL=/ftponly SHELLOPTS=braceexpand:hashall:interactive-comments:posix SHLVL=1 SPHERA_config=x SPHERA_monitor=xxxx SPHERA_pIOr=x SPHERA_pIOw=x SPHERA_pNETr=x SPHERA_pNETw=x SPHERA_service=xxxx TERM=dumb UID=2012 USER_NAME= _=/bin/sh

Other Summaries and Demos

You are visitor [Odometer] since 9 November 1996

Copyright © 1996-1999 Rex Swain
E-mail, Web