SSI Tutorial - Execute Scripts
1. CGI Scripts
Using SSI to include script output in your web pages is very similar
to including regular .html files.
<!--#include virtual="scriptname.cgi" -->
|
|
Replace scriptname.cgi with the name
of the script you wish to use. Script output will be included in the page.
If the script is in a directory, don't forget to add the directory name to your SSI command.
<!--#include virtual="/directory_name/scriptname.cgi" -->
|
|
Your creativity is the limit. Scripts could be used to include weather
forecasts, stock values and anything else cgi scripts available to you can output.
Server Side Includes could be used in this way to set and manage cookies
(to track visitors) and much more.
2. Executing Shell Commands
SSI can also be used to execute Linux shell commands
and include the output in your web page.
Replace the Linux command (w in this case).
The above SSI example uses the w command to output the server's
load averages, uptime and connected users.