Sample SSI


The "#exec" command


Source for the hello.pl program:
#!/usr/bin/perl

print "Content-Type: text/plain

Hello world!
This is the output of hello.pl!
";

exit(0);

Using the "cmd" tag

<!--#exec cmd="/usr/local/lib/httpd/cgi-bin/scott/hello.pl" -->
Content-Type: text/plain

Hello world!
This is the output of hello.pl!
==================
Complete Environment (from shell):

QUERY_STRING=
HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
DOCUMENT_PATH_INFO=
PWD=/nfs/www/WWW_pages/scott/ssi_example
REMOTE_PORT=35743
HTTP_ACCEPT=Accept: application/xhtml+xml,text/html;q=0.9,text/plain;
HTTP_USER_AGENT=CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
GATEWAY_INTERFACE=CGI/1.1
HTTP_HOST=thunder.sonic.net
LAST_MODIFIED=Thursday, 05-Dec-1996 01:05:54 PST
USER_NAME=scott
SCRIPT_NAME=/scott/ssi_example/index.shtml
SERVER_NAME=thunder.sonic.net
HTTP_ACCEPT_ENCODING=gzip
DATE_LOCAL=Saturday, 04-Jul-2009 00:46:19 PDT
HTTP_PRAGMA=no-cache
HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7
SCRIPT_FILENAME=/nfs/WWW-data/scott/ssi_example/index.shtml
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
_=/usr/local/lib/httpd/cgi-bin/scott/hello.pl
SERVER_ADDR=209.204.190.64
HTTP_X_CC_LIST=List:1 For:209.204.190.64
DOCUMENT_NAME=index.shtml
SERVER_PROTOCOL=HTTP/1.1
SHLVL=1
HTTP_CONNECTION=close
SERVER_SIGNATURE=
Apache/1.3.41 Server at thunder.sonic.net Port 80
DATE_GMT=Saturday, 04-Jul-2009 07:46:19 GMT SERVER_SOFTWARE=Apache/1.3.41 (Unix) mod_auth_pam/1.1.1 FrontPage/5.0.2.2635 PHP/4.4.9 SERVER_ADMIN=support@sonic.net REMOTE_ADDR=38.103.63.61 DOCUMENT_ROOT=/nfs/WWW-data REQUEST_URI=/scott/ssi_example/index.shtml DOCUMENT_URI=/scott/ssi_example/index.shtml REQUEST_METHOD=GET SERVER_PORT=80 HTTP_CACHE_CONTROL=no-cache ==================

Using the "cgi" tag

<!--#exec cgi="/cgi-bin/scott/hello.pl" -->
Hello world!
This is the output of hello.pl!
==================
Complete Environment (from shell):

QUERY_STRING=
HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
DOCUMENT_PATH_INFO=
REMOTE_PORT=35743
HTTP_USER_AGENT=CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
HTTP_ACCEPT=Accept: application/xhtml+xml,text/html;q=0.9,text/plain;
HTTP_HOST=thunder.sonic.net
GATEWAY_INTERFACE=CGI/1.1
LAST_MODIFIED=Thursday, 05-Dec-1996 01:05:54 PST
USER_NAME=scott
SCRIPT_NAME=/cgi-bin/scott/hello.pl
SERVER_NAME=thunder.sonic.net
HTTP_ACCEPT_ENCODING=gzip
DATE_LOCAL=Saturday, 04-Jul-2009 00:46:19 PDT
HTTP_PRAGMA=no-cache
HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7
SCRIPT_FILENAME=/nfs/www/httpd/cgi-bin/scott/hello.pl
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
SERVER_ADDR=209.204.190.64
HTTP_X_CC_LIST=List:1 For:209.204.190.64
DOCUMENT_NAME=index.shtml
SERVER_PROTOCOL=INCLUDED
HTTP_CONNECTION=close
SERVER_SIGNATURE=
Apache/1.3.41 Server at thunder.sonic.net Port 80
DATE_GMT=Saturday, 04-Jul-2009 07:46:19 GMT SERVER_SOFTWARE=Apache/1.3.41 (Unix) mod_auth_pam/1.1.1 FrontPage/5.0.2.2635 PHP/4.4.9 SERVER_ADMIN=support@sonic.net REMOTE_ADDR=38.103.63.61 DOCUMENT_ROOT=/nfs/WWW-data REQUEST_URI=/scott/ssi_example/index.shtml DOCUMENT_URI=/scott/ssi_example/index.shtml REQUEST_METHOD=GET HTTP_CACHE_CONTROL=no-cache SERVER_PORT=80 ==================

Today is Setting Orange, the 39th day of Confusion in the YOLD 3175 !
(<!--#exec cmd="/usr/bin/ddate" -->)
Scott Doty
scott@sonic.net