diff options
Diffstat (limited to 'usr.sbin/httpd/htdocs/manual/readme-tpf.html')
-rw-r--r-- | usr.sbin/httpd/htdocs/manual/readme-tpf.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/usr.sbin/httpd/htdocs/manual/readme-tpf.html b/usr.sbin/httpd/htdocs/manual/readme-tpf.html index 9d1a82a279c..bbf86aa4032 100644 --- a/usr.sbin/httpd/htdocs/manual/readme-tpf.html +++ b/usr.sbin/httpd/htdocs/manual/readme-tpf.html @@ -9,6 +9,7 @@ <HR> <CENTER>[ <A HREF="#configuration_files">Configuration Files</A> | <A HREF="#whats_available">What's Available</A> + | <A HREF="#cgi">CGI Scripts</A> | <A HREF="#porting_notes">Porting Notes</A> ] </CENTER> <HR> @@ -157,6 +158,69 @@ <LI>suexec.c </UL></MULTICOL> +<A NAME="cgi"> </A> +<H2 align=center>How to Use CGI Scripts</H2> +<P> + The following is a very simple example of a CGI script ("Hello World") and the necessary steps to run it.<BR> + Refer to the <A HREF="http://www.apache.org/docs/mod/mod_cgi.html">mod_cgi module</A> for + additional information.<BR> + + <H3>Add necessary directives to httpd.conf:</H3> + <UL> + Example: + <tt><BR><UL> + ScriptLog logs/script_log<BR> + ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/ + </tt></UL><BR> + A request for <tt>http://myserver/cgi-bin/filename.cgi</tt> would cause the server to run the script + <tt>/usr/local/apache/cgi-bin/filename.cgi</tt> + </UL> + + <H3>Create the CGI script:</H3> + <UL> + For this example <tt>QZZ1</tt> is the name of the TPF program that will be executed by the CGI script.<BR> + The directory path must match what is in the httpd.conf file for <tt>ScriptAlias</tt> directive.<BR><BR> + <UL> + <tt>zfile echo "#!QZZ1" > /usr/local/apache/cgi-bin/filename.cgi <BR><BR> + zfile cat /usr/local/apache/cgi-bin/filename.cgi </tt> + (this should display<tt>#!QZZ1</tt>)<BR><BR> + </UL> + </UL> + + <H3>Mark the script as executable:</H3> + <UL> + <tt>zfile chmod 755 /usr/local/apache/cgi-bin/filename.cgi<BR><BR></tt> + </UL> + + <H3>Create, load, and activate a loadset containing the CGI program (QZZ1xx):</H3> + <UL> + <code> + /** QZZ1-- simple "Hello world" program to demonstrate basic CGI output **/<BR><BR> + #include <stdio.h><BR><BR> + void main() {<BR><BR> + <UL> + /** Print the CGI response header, required for all HTML output. **/<BR> + /** Note the extra \n, to send the blank line. **/<BR><BR> + + printf("Content-type: text/html\n\n");<BR><BR> + + /** Print the HTML response page to stdout. **/<BR> + printf("<html>\n");<BR> + printf("<head><title> CGI Output </title></head>\n");<BR> + printf("<body>\n");<BR> + printf("<h1> Hello world </h1> \n");<BR> + printf("</body>\n");<BR> + printf("</html>\n");<BR><BR> + </UL> + }<BR> + </code> + </UL> + + <H3>Request the CGI script from a browser:</H3> + <UL> + <tt>http://myserver/cgi-bin/filename.cgi</tt><BR> + </UL> + <A NAME="porting_notes"> </A> <H2 align=center>Porting Notes</H2> <P> @@ -201,6 +265,7 @@ <CENTER>[ <A HREF="#top">top</A> | <A HREF="#configuration_files">Configuration Files</A> | <A HREF="#whats_available">What's Available</A> + | <A HREF="#cgi">CGI Scripts</A> | <A HREF="#porting_notes">Porting Notes</A> ] </CENTER> |