- publishing free software manuals
The Apache HTTP Server Reference Manual
by Apache Software Foundation
Paperback (6"x9"), 862 pages
ISBN 9781906966034
RRP £19.95 ($29.95)

Get a printed copy>>>

10.7  Executing commands

You can actually have SSI execute a command using the shell (/bin/sh, to be precise - or the DOS shell, if you’re on Win32). The following, for example, will give you a directory listing.

<!--#exec cmd="ls" -->

or, on Windows

<!--#exec cmd="dir" -->

You might notice some strange formatting with this directive on Windows, because the output from dir contains the string “<dir>” in it, which confuses browsers.

Note that this feature is exceedingly dangerous, as it will execute whatever code happens to be embedded in the exec tag. If you have any situation where users can edit content on your web pages, such as with a “guestbook”, for example, make sure that you have this feature disabled. You can allow SSI, but not the exec feature, with the IncludesNOEXEC argument to the Options directive.

ISBN 9781906966034The Apache HTTP Server Reference ManualSee the print edition