<?xml version="1.0"?>
<!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
<modulesynopsis>

<name>mod_cgid</name>
<description>Execution of CGI scripts using an
    external CGI daemon</description>
<status>Base</status>
<sourcefile>mod_cgid.c</sourcefile>
<identifier>cgid_module</identifier>
<compatibility>Unix threaded MPMs only</compatibility>

<summary>
    <p>Except for the optimizations and the additional <directive
    module="mod_cgid">ScriptSock</directive> directive noted below,
    <module>mod_cgid</module> behaves similarly to <module>mod_cgi</module>.
    <strong>See the <module>mod_cgi</module> summary for additional details
    about Apache and CGI.</strong></p>

    <p>On certain unix operating systems, forking a process from a
    multi-threaded server is a very expensive operation because the
    new process will replicate all the threads of the parent
    process. In order to avoid incurring this expense on each CGI
    invocation, <module>mod_cgid</module> creates an external daemon that is
    responsible for forking child processes to run CGI scripts. The
    main server communicates with this daemon using a unix domain
    socket.</p>

    <p>This module is used by default instead of
    <module>mod_cgi</module> whenever a multi-threaded MPM
    is selected during the compilation process. At the user level,
    this module is identical in configuration and operation to
    <module>mod_cgi</module>. The only exception is the
    additional directive <code>ScriptSock</code> which gives the
    name of the socket to use for communication with the cgi
    daemon.</p>
</summary>

<seealso><module>mod_cgi</module></seealso>
<seealso><a href="../suexec.html">Running CGI programs under different user IDs</a></seealso>

<directivesynopsis location="mod_cgi">
<name>ScriptLog</name>
</directivesynopsis>

<directivesynopsis location="mod_cgi">
<name>ScriptLogLength</name>
</directivesynopsis>

<directivesynopsis location="mod_cgi">
<name>ScriptLogBuffer</name>
</directivesynopsis>

<directivesynopsis>
<name>ScriptSock</name>
<description>The name of the socket to use for communication with
the cgi daemon</description>
<syntax>ScriptSock <var>file-path</var></syntax>
<default>ScriptSock logs/cgisock</default>
<contextlist><context>server config</context>
<context>virtual host</context></contextlist>

<usage>
    <p>This directive sets the name of the socket to use for
    communication with the CGI daemon. The socket will be opened
    using the permissions of the user who starts Apache (usually
    root). To maintain the security of communications with CGI
    scripts, it is important that no other user has permission to
    write in the directory where the socket is located.</p>

    <example><title>Example</title>
      ScriptSock /var/run/cgid.sock
    </example>

</usage>
</directivesynopsis>

</modulesynopsis>

