CGI

CGI is short for " The Common Gateway Interface ". CGI is a method used to exchange data between the server (hosts your web site) and a web client (your browser).

Some of the more common uses of CGI include:

  • Guestbooks
  • Email Forms
  • Mailing List Maintenance

CGI scripts are simply text or ASCII files which are 'compiled on the fly' (interpreted by a program on the server rather than the browser) by the Perl interpreter. They can be edited or created on any text editor and must be saved with a '.cgi' file extension. The common choice for writing and processing CGI is Perl, or "Practical extraction and reporting language". A CGI program can however be compiled in any language that allows it to be executed on the system, such as:

  • C/C++,
  • Fortran,
  • PERL,
  • TCL,
  • Any Unix shell,
  • Visual Basic
  • AppleScript.

In order to use CGI, you must be able to do a few things with your Internet account. You must be able to:

  • Telnet into the system
  • Create directories
  • Change directory modifications
Requirements of CGI
  • Your web address must have a directory named '/cgi-bin/' to include your cgi scripts in.
  • When uploading by ftp it needs to be uploaded in 'Text' or 'ASCII' mode and not in 'Automatic' or 'Binary' mode.
  • With ftp you may want to set permissions by using chmod so that users cannot alter, use or view your script.

CGI FAQ

CGI Perl FAQ


(c) Copyright 2002 Internet Guide