Free CGI Scripts

Category: Web Hosting Tutorials

CGI Scripts, CGI Proxy, and CGI-bin are phrases you will want to become familiar with. Free CGI Scripts can be useful tools for making your website more interactive with your visitors and giving your website a more professional feel. So, what exactly are CGI Scripts and how do they work?

Top Web Hosts
  • $3.49 Month
  • Free Templates!
  • Unlimited Space
  • Frontpage Hosting
  • Fantastico Enabled
  • Unlimited Domains!

  • Visit HostMonster ]
  • $2.25 Month
  • Unlimited Storage
  • Easy Site Builder
  • PHP/MySQL Database
  • Ecommerce Tools

  • Visit iPage ]
  • $4.99 Month
  • 10 GB Storage
  • 300 GB Transfer
  • 3 Month Billing!
  • Cheap Domain Name
  • 10% Off in Cart

  • Visit GoDaddy ]
What are CGI Scripts?
The difference between your web site just being a virtual billboard and it being an interactive web site, is having the ability to get information to and from your viewers. The Web provides a mechanism for accomplishing this, CGI, the Common Gateway Interface, using CGI scripts. An example of a CGI script would be: Shopping cart systems, hit counters, guestbooks, order forms, mail, maps, etc.

CGI scripts are the way most servers communicate with other programs and scripts. CGI scripts are simple text files, lines of code, that are interpreted as requested by the server. A CGI script will work together with other programs and with the HTML content of your web page. Since HTML alone only allows for information to be displayed, CGI scripts give HTML the ability to interact with the visitor. CGI scripts can be written in Perl, PHP, C, Visual Basic, or Python. CGI is not a programming language itself. It's more of a protocol for communication between the web server and the script. Perl and PHP seem to be the languages of choice, because they are easy to learn and are very portable.

How Does A CGI Script Work?
A CGI Script is a collection of lines of code that contain instructions for the server. Unlike a simple HTML document request, a CGI-BIN (Common Gateway Interface) request requires something a whole lot smarter than a regular HTML request for content from the server. When you click on a link that looks like:, you are really instructing the server to run an actual program that handles only this one type of request. In this case it runs the program that calls up the form that allows you to make an entry in the guestbook. Here is a breakdown of what actually happens:

Your browser sends the request shown above to the server.

The server runs the guestbook.cgi program.

The guestbook.cgi program realizes that you are not adding anything yet, so it makes the decision to create and return to you, a blank data entry form.

Your browser then displays this form as it would any other HTML document.

So you take a moment and fill in all the fields and click on the SUBMIT button. Now a more complex series of actions take place. The command in the browser location window may look something like this:

When the CGI receives the request, it executes a program called guestbook.cgi that is located in the Guestbook directory under cgi-bin. What is different now is that in addition to a program request, information is being fed to the CGI script.

This is what the script then does:

Load the guestbook.cgi program into memory for running.

It notices that it has to split up the information using the & as a way of telling where one bit starts and ends.

Seeing that the e-mail has a name in it, sends a thank you note to the person that signed the book.

Sends a note to the webmaster that a new entry is in the guestbook.

Takes all the input data, and uses the information to create a new entry that is tagged onto the guestbook.html document.

Creates an HTML document saying "Thank you for signing my guestbook!" that is returned to the browser. And the CGI's job is finished.

The important concept is that in order to use CGI-BIN or a CGI script, you must create a real, however big or small computer program. It is not embedded in your HTML document, but it is installed in your cgi-bin directory located on your server.

What are Free CGI Scripts?
Free CGI scripts are prewritten applications in PERL or other programming code, that you can download or copy straight from the provider. By utilizing the many free CGI scripts available you can have CGI features on your site (guestbook, forms, etc.), but don't need any programming skills to create these features on your own. Usually the free CGI scripts will run from the CGI providers servers, so you don't have to deal with complex installation and maintenance procedures. Free CGI scripts like hit counters and guestbooks are offered by most web hosts. If your web host doesn't offer these features, here are a few resources for Free CGI Scripts: HotScripts, The CGI Resource Index, Free-Scripts.Net, Script Search

Do I need CGI Scripts in the hosting package I choose?
In order to use CGI programs, your server must be configured to support them. Check with your system administrator as to whether or not you can use them, and if so, where your CGI programs must reside. If you are not allowed to do CGI on your server- consider moving to someplace where you can, or finding somebody to host your scripts. If you would like to have a shopping cart, guestbooks, counters, or other visitor interactive type features on your site you will need a web host that supports CGI scripts.

Related Article: PERL Scripting >>

100 Best Web Hosting Terms
Term of the day
Java Servlet
A Java Servlet is an object created in the Java programming language that allows software developers to add dynamic content to a web server. A Java Servlet can be designed to respond to a request from a client. The servlet will receive the request, find the requested information, and then send it back to the client.

Web Hosting Tutorials

Web Hosting Categories
Web Hosting Tutorials
Domain Registration
Email Services & Tools
Related Awards
Web Host Comparisons