Dealing With CGI Installation Jitters

  Translate: Chinese | Dutch | French | German | Italian | Japanese | Latin American Spanish

If you get the jitters just thinking about installing a CGI program, this article is for you.

The best way to get over the jitters, that I know of, is to go ahead and install one. This article has a four-line script you can use to practice with.

Two things to remember when working with scripts

  1. When editing Perl CGI scripts, always use a plain text word processor. NotePad (PC) or BBEdit (Mac) are your friends.

  2. When uploading Perl CGI scripts, always do so with an FTP program and transfer the file in plain text mode (as opposed to binary mode).

    Using methods other than FTP, such as FrontPage or even some so-called "upload control panels" can break scripts. If you don't have an FTP program, lists several.

    "FTP" means "File Transfer Protocol." Use the tool for the job.

Of course, you'll need to have a directory on your server that is allowed to run Perl CGI programs. These directories are often referred to as the cgi-bin, and sometimes the directories even have that name. Other common names for the cgi-bin are "cgi-local" and "cgi". If unsure, ask your hosting company.

If your hosting company does not allow you to run CGI scripts, you might consider opening an account with one who does. Free hosting like that available from Hypermart at is an option, especially when getting started and wanting experience to help make future hosting decisions.

Time to Practise!

Here is the 4-line script you can practice with

$Message = "<h1>Congratulations, my friend!</h1>"; 
print "Content-type: text/html\n\n"; 
print "<html><body>$Message</body></html>";

Copy and paste (or type) the above 4 lines into NotePad or BBEdit. Save the file as practice.cgi (or something.cgi if you already have a file named practice.cgi on your hard drive or on your server).

Verify that the first line of the script is correct. It must start with the characters #! and be followed with the location of the Perl interpreter on the server. Your hosting company can tell you that location. The correct line is probably #!/usr/bin/perl or #!/usr/local/bin/perl

Use your FTP program to upload practice.cgi onto your cgi-bin.

Once uploaded to your server, the script needs permission to run. Some servers are configured to automatically set the correct permissions when scripts are uploaded. If yours doesn't, set permissions to global execute. That is

      user - read/write/execute
     group - read/execute
     other - read/execute

which corresponds to permissions number 755. Your FTP program is the tool to use for setting permissions. Different programs have different methods of doing so, but most have either checkboxes where you can select according to the list above or a place where you can type in the permissions number. If your FTP program requires a 4-digit number, use 0755.

For a more extensive discussion of "permissions", see the "Unix/Linux File Permissions" article linked from

To run practice.cgi, type its URL into your browser, something like this

If everything works as it should, you should see

     Congratulations, my friend!

in your browser window.

If it doesn't work, try the installation process again; start from the beginning with a clean slate. The error might have been something overlooked or a simple mistake.

If it still doesn't work try one of these resources

The FAQ at lists the common reasons for installations to fail.

The "How to Install CGI Programs" ebook written by your author (published by Intellectua of ) and obtainable from has lots of additional information.

Even if things go well with practice.cgi, consider buying "How to Install CGI Programs" ($12.95). It is a great tutorial and could be indispensable for future installations.

Now that you've installed practice.cgi, you might try your hand at editing it. Change the message to something with your name in it, for example. Then do another change, like adding an HTML horizontal rule tag <hr> into the last line of the script, before or after the $Message variable.

To increase your confidence, install some of the scripts from the Master Series at Master Feedback and Master Recommend, both free, are fairly easy to install and provide basic functionality every web site should have.

The more you work with scripts, the more confident you will become.

And when you're filled to the brim with confidence and want to tackle writing your own script, read the 4-part "Writing Your Own Form Handling Scripts" series linked from

That should keep you busy until next week :)

By: Will Bontrager

Copyright 2002 Bontrager Connection, LLC

If you are using a Pop Up Blocker be sure to Okay this site for PayPal to work properly


EZ-Response Follow Up Sequential Email Autoresponder

Now you can send unlimited follow up emails with file attachments automatically from your website. Make as many sequential letters as you need and send them at the interval you specify. Unlimited autoresponders, Unlimited follow ups, Unlimited users. One-click "remove-me" link. Easy to set-up and configure in 10 minutes. EZ -Response works without CRON jobs (which are not allowed on many servers). It's simple, efficient, and Automatic!

Fact: A recent study conducted by Sales and Marketing Executives International concluded that 81% of major sales are closed after the fifth contact.

Fact: 80% of people who inquire about a product or service will buy it within one year of their initial inquiry. However, more than 90% of the time, they don't buy from the same company that they made their initial contact with.




Ez-Response Search