What is CGI?

This article contains information about CGI.

The most common way to create dynamic content is to use CGI (Common Gateway Interface), which is the web server that executes a program generating an HTML page as output. There are two methods used to pass information (such as the content of the input fields in a form) to the program: GET and POST. The information is encoded and needs to be decoded. There are common libraries for Perl, C, etc. for handling CGI input.

In your web page you need to reference the CGI either as link or as ACTION in the form tag if the CGI is supposed to handle a form. Example:


On NT web servers, script file extensions are associated with the interpreter for the language (e.g. - .pl files are associated with Perl and will be directly executed).

On Unix web servers, the scripts need to begin with #! and the interpreter location (e.g. Perl scripts must start with the line #!/usr/local/bin/perl ). Also, the scripts must have executable permissions for the web server - after you upload the scripts, FTP to your web server with your username and password, and change the permissions to 755. Some FTP programs support changing permissions with a function named “chmod” or simply “change permissions.”

Last Updated: 31st of May, 2011     Article ID: 267

301 Moved Permanently

Moved Permanently

The document has moved here.

Apache Server at Port 80