]> granicus.if.org Git - apache/blobdiff - docs/manual/howto/cgi.xml
"most common". Sheesh.
[apache] / docs / manual / howto / cgi.xml
index c917bdfc637757883358d8b8f6e49a0a07b8dc90..3888a98bc4c8af952b95c0b1fff222b24ab02052 100644 (file)
@@ -32,6 +32,7 @@
       <modulelist>
         <module>mod_alias</module>
         <module>mod_cgi</module>
+        <module>mod_cgid</module>
       </modulelist>
 
       <directivelist>
@@ -44,8 +45,9 @@
     <p>The CGI (Common Gateway Interface) defines a way for a web
     server to interact with external content-generating programs,
     which are often referred to as CGI programs or CGI scripts. It
-    is the simplest, and most common, way to put dynamic content on
-    your web site. This document will be an introduction to setting
+    is a simple way to put dynamic content on
+    your web site, using whatever programming language you're most
+    familiar with. This document will be an introduction to setting
     up CGI on your Apache web server, and getting started writing
     CGI programs.</p>
   </section>
     directive has not been commented out.  A correctly configured directive
     may look like this:
 
-    <example>
+    <highlight language="config">
+      LoadModule cgid_module modules/mod_cgid.so
+    </highlight>
+
+
+     On Windows, or using a non-threaded MPM like prefork,  A correctly 
+     configured directive may look like this:
+
+    <highlight language="config">
       LoadModule cgi_module modules/mod_cgi.so
-    </example></note>
+    </highlight></note>
+
 
     <section id="scriptalias">
       <title>ScriptAlias</title>
@@ -83,9 +94,9 @@
       <p>The <directive module="mod_alias">ScriptAlias</directive>
       directive looks like:</p>
 
-      <example>
-        ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/
-      </example>
+      <highlight language="config">
+ScriptAlias "/cgi-bin/" "/usr/local/apache2/cgi-bin/"
+      </highlight>
 
       <p>The example shown is from your default <code>httpd.conf</code>
       configuration file, if you installed Apache in the default
       file, to specify that CGI execution was permitted in a particular
       directory:</p>
 
-      <example>
-        &lt;Directory /usr/local/apache2/htdocs/somedir&gt;<br />
-        <indent>
-          Options +ExecCGI<br />
-        </indent>
-        &lt;/Directory&gt;
-      </example>
+      <highlight language="config">
+&lt;Directory "/usr/local/apache2/htdocs/somedir"&gt;
+    Options +ExecCGI
+&lt;/Directory&gt;
+      </highlight>
 
       <p>The above directive tells Apache to permit the execution
       of CGI files. You will also need to tell the server what
       files with the <code>cgi</code> or <code>pl</code> extension as CGI
       programs:</p>
 
-      <example>
+      <highlight language="config">
         AddHandler cgi-script .cgi .pl
-      </example>
+      </highlight>
     </section>
 
     <section id="htaccess">
       <code>.cgi</code> in users' directories, you can use the
       following configuration.</p>
 
-      <example>
-      &lt;Directory /home/*/public_html&gt;<br/>
-      <indent>
-        Options +ExecCGI<br/>
-        AddHandler cgi-script .cgi<br/>
-      </indent>
-      &lt;/Directory&gt;
-      </example>
+      <highlight language="config">
+&lt;Directory "/home/*/public_html"&gt;
+    Options +ExecCGI
+    AddHandler cgi-script .cgi
+&lt;/Directory&gt;
+      </highlight>
 
       <p>If you wish designate a <code>cgi-bin</code> subdirectory of
       a user's directory where everything will be treated as a CGI
       program, you can use the following.</p>
 
-      <example>
-      &lt;Directory /home/*/public_html/cgi-bin&gt;<br/>
-      <indent>
-        Options ExecCGI<br/>
-        SetHandler cgi-script<br/>
-      </indent>
-      &lt;/Directory&gt;
-      </example>
+      <highlight language="config">
+&lt;Directory "/home/*/public_html/cgi-bin"&gt;
+    Options ExecCGI
+    SetHandler cgi-script
+&lt;/Directory&gt;
+      </highlight>
 
     </section>
 
       file called <code>first.pl</code>, and put it in your
       <code>cgi-bin</code> directory.</p>
 
-      <example>
-        #!/usr/bin/perl<br />
-        print "Content-type: text/html\n\n";<br />
-        print "Hello, World.";
-      </example>
+      <highlight language="perl">
+#!/usr/bin/perl
+print "Content-type: text/html\n\n";
+print "Hello, World.";
+      </highlight>
 
       <p>Even if you are not familiar with Perl, you should be able
       to see what is happening here. The first line tells Apache
       interpreter (often <code>perl</code>) indicated in the first
       line of your CGI program, which will look something like:</p>
 
-      <example>
+      <highlight language="perl">
         #!/usr/bin/perl
-      </example>
+      </highlight>
 
       <p>Make sure that this is in fact the path to the
       interpreter.</p>
       <a href="../env.html">add your own environment variables</a>
       to the basic ones provided by default.</p>
 
-      <example>
-        #!/usr/bin/perl<br />
-        print "Content-type: text/html\n\n";<br />
-        foreach $key (keys %ENV) {<br />
-        <indent>
-          print "$key --&gt; $ENV{$key}&lt;br&gt;";<br />
-        </indent>
-        }
-      </example>
+      <highlight language="perl">
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+print "Content-type: text/html\n\n";
+foreach my $key (keys %ENV) {
+    print "$key --&gt; $ENV{$key}&lt;br&gt;";
+}
+      </highlight>
     </section>
 
     <section id="stdin">
     have found a problem in the Apache source code.</p>
   </section>
 </manualpage>
-