mod_cgi.html revision a902ab8fc247cc32dda1479e9c069f59aa22a6e1
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<!--#include virtual="header.html" -->
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnThis module is contained in the <code>mod_cgi.c</code> file, and
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnis compiled in by default. It provides for execution of CGI scripts.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnAny file with mime type <code>application/x-httpd-cgi</code> will be
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnprocessed by this module.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<!--%plaintext <?INDEX {\tt application/x-httpd-cgi} mime type> -->
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<!--%plaintext <?INDEX CGI scripts> -->
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnAny file that has the mime type <code>application/x-httpd-cgi</code>
eb5a5c7888f20ad6fa4580e785308db395ef6dfcSurya Prakkior handler <code>cgi-script</code> (Apache 1.1 or later)
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnwill be treated as a CGI script, and run by the server, with its output
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnbeing returned to the client. Files acquire this type either by
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnhaving a name ending in an extension defined by the
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<A HREF="mod_mime.html#addtype">AddType</A> directive, or by being in
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnna <A HREF="mod_alias.html#scriptalias">ScriptAlias</A> directory. <p>
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnWhen the server invokes a CGI script, it will add a variable called
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<code>DOCUMENT_ROOT</code> to the environment. This variable will contain the
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnvalue of the <A HREF="core.html#documentroot">DocumentRoot</A>
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnconfiguration variable.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnThe server will set the CGI environment variables as described in the CGI
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnspecification, with the following provisos:
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<dt>REMOTE_HOST
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<dd>This will only be set if the server has not been compiled with
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<dt>REMOTE_IDENT
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<dd>This will only be set if
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<A HREF="core.html#identitycheck">IdentityCheck</A> is set to <code>on</code>.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<dt>REMOTE_USER
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnn<dd>This will only be set if the CGI script is subject to authentication.
9acbbeaf2a1ffe5c14b244867d427714fab43c5cnnDebugging CGI scripts has traditionally been difficult, mainly because
<!--#include virtual="footer.html" -->