SSI:The Exec Directive
This directive is used to instruct the webserver to run an external application or a system command. #execs bear one of two forms
- <!--#exec cmd="value" --> - used to run a system command.
- <!--#exec cgi="value" --> - used to run a CGI script.
Running system commands via this directive is dangerous and is best avoided. Indeed, many site hosts block the use of the <!--#exec cmd=... form of this directive altogether. Typical examples of this directive are illustrated below
| Directive | Meaning | Output |
|---|---|---|
| <!--#exec cmd="ping explainth.at" --> | Pings explainth.at | Ping results |
| <!--#exec cmd="ls" --> | Directory listing - use "dir" on Windows | Directory listing |
| <!--#exec cgi="/scripts/myip.php" --> | CGI script is run and results merged into HTML document | Your IP address is 38.107.191.84 |