How to Make CGI Work

Page content

CGI, which stands for Common Gateway Interface, is a method of exchanging data between the server and the web client. In simpler terms, it’s how your PC, and the software within, communicates with the browser that you use.

As a processing system, CGI uses routines that are prescribed to perform actions with received data.

It has many uses, among them guest books, popular additions to websites where messages are left by readers. The CGI routine not only creates the entry, but may be used to send an email to the writer and a notification to a webmaster that a message has been left.

It is also used for email forms where and applicant enters details and sends it to an address, and for mailing list functions, too.


Although a great number of programming on websites now use PHP, CGI is far from extinct, as it still retains some unique codes that can only be run by its own methods.

One of the problems encountered these days is that CGI may not run on some hosts, but it is a fact that the majority of Unix hosts accommodate CGI. It will not run, however, if your host does not support it.

Perl, the popular and very simple programming language, uses CGI script, however some users have experienced problems in getting CGI scripts to work.

Easy mistakes to make

It is important to remember that Perl is considered a very ‘forgiving’ language, and this may lead to some open ended CGI scripts, or those that have not been closed properly. Make sure all scripts are correctly entered and enhanced.

A common mistake in not getting a CGI script to work is in directing it to a host to take information that may be protected. This can return error messages that are misleading when the problem is that the information is not readily available for one reason or another.

Simple mistakes lead to many problems, but others may be caused by older CGI scripts mixed with newer Perl scripts.

Many users download packages from the internet that can help with this problem, such as ActivePerl, a software package designed specifically to help with CGI script problems. Another is the popular and widely used Apache, built for a similar purpose.

If you continue to experience problems with CGI scripts there are a number of such packages available, but the two mentioned above are among the best and most widely used.

Forums can be useful

There are also many forums on the web that have sprung up as a result of the growing numbers of people who are indulging in web design, either at home or for business purposes, and these can be useful sources of advice for newcomers as well as experienced users who are willing to share their experience.

CGI scripts can be troublesome, but can also be extremely useful. With many functions still being unique to CGI it is worth mastering the technique in order to experience greater success in programming.