Recipe 8.11 Including the Output of a CGI Program

Problem

You want to have the output of a CGI program appear within the body of an existing HTML document.

Solution

Use SSIs by adding a line such as the following to the document (which must be enabled for SSI parsing):

<--#include virtual="/cgi-bin/content.cgi" -->

Discussion

The SSI #include directive, in addition to being able to include a plain file, can also include other dynamic content, such as CGI programs, other SSI documents, or content generated by any other method.

The #exec SSI directive may also be used to produce this effect, but for a variety of historical and security-related reasons, its use is deprecated. The #include directive is the preferred way to produce this effect.

Note that Options IncludeNoExec, in addition to disabling the #exec SSI directive, also forbids the inclusion of CGI programs using the #include virtual syntax. Thus, this method cannot be used to circumvent the restriction.

See Also

  • Recipe 8.8



Apache Cookbook
Apache Cookbook: Solutions and Examples for Apache Administrators
ISBN: 0596529945
EAN: 2147483647
Year: 2006
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net