1<HTML> 2<!-- SECTION: Getting Started --> 3<HEAD> 4 <TITLE>Using CGI Programs</TITLE> 5 <LINK REL="STYLESHEET" TYPE="text/css" HREF="/cups-printable.css"> 6</HEAD> 7<BODY> 8 9<H1 CLASS="title">Using CGI Programs</H1> 10 11<P>CUPS provides a dynamic web interface through dedicated CGI programs that 12are executed when users open special directories on the CUPS server. Each CGI 13performs administration, class, help, job, and printer functions as directed by 14the user, but the actual programs that are run and functions that are available 15are limited to those that were originally designed into the scheduler.</P> 16 17<P>CUPS also supports CGI programs and specific scripting languages (Java, Perl, 18PHP, and Python) for pages you want to provide. The interpreters for these 19languages are currently configured at compile time and are associated with 20MIME media types. <a href="#TABLE1">Table 1</a> shows the MIME media types that 21are reserved for each type of page and are the same as those used by the Apache 22web server.</P> 23 24<DIV CLASS="table"><TABLE SUMMARY="CGI MIME Media Types"> 25<CAPTION><A NAME="TABLE1">Table 1</A>: CGI MIME Media Types</CAPTION> 26<TR> 27 <TH>MIME Media Type</TH> 28 <TH>Description</TH> 29</TR> 30<TR> 31 <TD>application/x-httpd-cgi</TD> 32 <TD>CGI script/program</TD> 33</TR> 34<TR> 35 <TD>application/x-httpd-java</TD> 36 <TD>Java program</TD> 37</TR> 38<TR> 39 <TD>application/x-httpd-perl</TD> 40 <TD>Perl script</TD> 41</TR> 42<TR> 43 <TD>application/x-httpd-php</TD> 44 <TD>PHP script</TD> 45</TR> 46<TR> 47 <TD>application/x-httpd-python</TD> 48 <TD>Python script</TD> 49</TR> 50</TABLE></DIV> 51 52<H2><A NAME="CONFIG">Configuring the Server</A></H2> 53 54<P>In order to enable the corresponding type, you must create a 55new <VAR>/etc/cups/cgi.types</VAR> file which maps the filename 56extensions to the appropriate MIME types, for example:</P> 57 58<PRE CLASS="command"> 59application/x-httpd-cgi cgi 60application/x-httpd-java class 61application/x-httpd-perl pl 62application/x-httpd-php php 63application/x-httpd-python py 64</PRE> 65 66<P>CGI scripts/programs (application/x-httpd-cgi) also must have execution 67permissions to be treated as a CGI script or program.</P> 68 69<H2><A NAME="LIMITS">Limitations</A></H2> 70 71<P>CUPS implements most of the CGI/1.1 specification, with the 72following exceptions:</P> 73 74<UL> 75 76 <LI>No PATH_INFO or PATH_TRANSLATED support</LI> 77 78 <LI>Limited HTTP field support; only the Content-Length 79 (CONTENT_LENGTH), Cookie (HTTP_COOKIE), and User-Agent 80 (HTTP_USER_AGENT) fields are placed in environment 81 variables at this time</LI> 82 83</UL> 84 85</BODY> 86</HTML> 87