Click to return to home page
Richard Lowe Jr Home

CGI scripting is a good way to add functionality to your site

Plain old HTML is very static and unchanging. CGI is an attempt to allow a static web page to interface with a web server. Basically, a web page is static and the CGI interface is dynamic.

For example, if you wanted to look up a customer number, you could write a small routine in CGI to do so. This routine would transmit the customer number back to the server, which would query the database and send it back to the web page for display.

This is a simple example of CGI, which is actually extremely powerful. There is virtually no limit to what you can implement with this technology.

It is important to remember that CGI is the technology of allowing a web page to run scripts or programs on the server. The actual language in which a CGI routine is written can vary. Perl is very popular, as is C and C++. Other languages such as TCL may also be used.

It's important to understand that CGI is not a language in itself. It is instead a specification for allowing the web page to communicate with a web server. You can write CGI applications in just about any language, including Fortran, C++, TCL, Visual Basic, Applescript or Perl. some of these languages are compiled and some can be run as script.

For security reasons, CGI code must run out of a special directory on the server, generally called cgi-bin. The webmaster will install CGI programs for you in this directory.

There is much more to CGI than I can teach you here, and there are many very good references and sites for you to read and explore.  The point is that CGI is an option, especially if you have some control over the server.

One of the main drawbacks to CGI is the difficulty of convincing a webmaster to install your applications. There are security risks associated with CGI routines (since they do run on the server) and most webmasters will not allow user-written CGI routines.  This is especially true of the free hosting companies.

Additional Reading

  • CGI scripting CGI scripts are a way to get data to and from a server. Many paid hosts support it, and some of the free hosts are beginning to.
  • CGI- What the Heck Is That? What is CGI? It's a way to get a web server to do something for you.
  • CGI protection codes Adding CGI scripts to your web site? Be sure you understand how the protection scheme works before you do!
  • Drawbacks Of CGI CGI scripts are a universal and easy way to get a server to do something for you. However, there are some drawbacks.
  • Formmail Security Issues Formmail is a great CGI routine which is very common on the internet. It is used to allow data to be entered and emailed, and it has a basic security flaw.

Unless otherwise noted, all photos and text is Copyright © Richard G Lowe, Jr.