Using CGI Programs

CUPS provides 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.

CUPS also supports CGI programs and specific scripting languages (Java, Perl, PHP, and Python) for pages you want to provide. The interpreters for these languages are currently configured at compile time and are associated with MIME media types. Table 1 shows the MIME media types that are reserved for each type of page and are the same as those used by the Apache web server.

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 types, 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 be owned by root, have execution permissions, and not have world or group write permissions to be treated as a CGI script or program.


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