The Common Gateway Interface


The Common Gateway Interface, or CGI, is a standard for external gateway programs to interface with information servers such as HTTP servers.

The current version is CGI/1.1. The differences between 1.1 and 1.0 are minor, see the list.


Documentation on the Interface Itself

You should first read this introduction to CGI to find out what it is, how it affects you, what you can use it for, and where it came from.

If you are a veteran of NCSA httpd or some versions of the CERN httpd, and remember the /htbin stuff, you should read this guide to upgrading your scripts to CGI compliance. It's not as painful as you might think.

Once you have a basic idea of what CGI is and what you can use it for, you should read this primer which will help you get started writing your own gateways.

If you are interested in handling the output of HTML forms with your CGI program, you will want to read this guide to handling forms with CGI programs.

Security is a crucial issue when writing CGI programs. Please read these tips on how to write CGI programs which do not allow malicious users to abuse them.

When you get more advanced, you should read the interface specification which will help you utilize CGI to the fullest extent. If you are a server software author, it will help you add CGI compliance to your information server.


Examples of CGI behavior and programs

You may wish to look at this page of examples which demonstrate how the client URL affects the interface variables.

We have created an archive of CGI programs on our FTP server. These programs were written by various people around the world in a variety of programming languages. Some of the entries are libraries which may make writing your CGI program easier.

If you would like to submit one of your CGI programs to the archive, you should first package it with any documentation, copyright notices, etc. Then, upload it to ftp.ncsa.uiuc.edu into the directory /incoming/cgi and send mail to [email protected] with a short description of what the file is.


Rob McCool [email protected]