Documentation

 Login     CUPS      Book      DDK      Printer Drivers      ESP Ghostscript      Forums      Links      Windows  
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  ]
 
Using CGI Programs

CUPS has traditionally provided a dynamic web interface through dedicated CGI programs that are executed when users open special directories on the CUPS server. Each CGI performs administration, class, help, job, and printer functions as directed by the user, but the actual programs that are run and functions that are available are limited to those that were originally designed into the scheduler.

Support is now available for CGI programs and specific scripting languages, currently Java, Perl, PHP, and Python. The interpreters for these languages are currently configured at compile time. Future versions may expand the interface to allow for generic support of scripting languages similar to the Apache "AddHandler" directive, but with external programs instead of modules.

Table 1 shows the MIME media types that are reserved for the CGI support in CUPS. The names have been chosen to mirror those used by Apache:

Table 1: CGI MIME Media Types
MIME Media Type Description
application/x-httpd-cgi CGI script/program
application/x-httpd-java Java program
application/x-httpd-perl Perl script
application/x-httpd-php PHP script
application/x-httpd-python Python script

Configuring the Server

In order to enable the corresponding type, you must create a new /etc/cups/cgi.types file which maps the filename extensions to the appropriate MIME type, for example:

application/x-httpd-cgi cgi
application/x-httpd-java class
application/x-httpd-perl pl
application/x-httpd-php php
application/x-httpd-python py

CGI scripts/programs (application/x-httpd-cgi) also must have execution permissions to be treated as a CGI script or program.

Limitations

CUPS implements most of the CGI/1.1 specification, with the following exceptions:

  • No PATH_INFO or PATH_TRANSLATED support
  • Limited HTTP field support; only the Content-Length (CONTENT_LENGTH), Cookie (HTTP_COOKIE), and User-Agent (HTTP_USER_AGENT) fields are placed in environment variables at this time
 
 

Comments are owned by the poster. All other content is copyright 2007-2008 by Apple Inc. CUPS, the Common UNIX Printing System, and the CUPS logo are the trademark property of Apple Inc. All other trademarks are the property of their respective owners. Please report site problems to 'webmaster@cups.org'.