[Check Your Domain]

Help Quest . com for an Internet presence with pizzazz!
for an Internet Presence with PIZZAZZ!

Service Plans
Place an Order!

Promotion Tips



CGI Tutorial

Have you considered HelpQuest.Com's interactive
Support Forums
for answers to frequently asked questions?

This tutorial is not about using proper syntax for CGI/Perl, but rather configuring your scripts to run properly on our server.

What is CGI/Perl?

Perl was originally designed to be a interpreter to help UNIX users with common tasks. However, with the explosive growth of the Internet it has been adapted to be an excellent interface to the web.

Perl has become the preferred programming language for making websites dynamic and user interactive. For example, you can use Perl to grab the data from your webpage forms and perhaps write this data to a file (as in a guestbook) or send it to you via E-mail (as in a form). We will discuss some of the basic principles to running PERL.

Back to the top.

Links to places where you can learn CGI/Perl

The following is a list of recommended sites we recommend for persons interested in learning the actual programming language of Perl. This tutorial does not get into the syntax. We only discuss configuring your scripts for use on our server.

Visit the following list of sites if you are interested in learning Perl:
Back to the top.
Links to free CGI/Perl archives!

Because of the enormous popularity surrounding Perl, many websites have becomed devoted to its growing success by offering free CGI/Perl scripts to visitors. The following list of websites offers quality CGI/Perl scripts that have been tested on our server, ranked in descending order.

Back to the top.
You can obtain Perl source code from the following website:
Back to the top.
Setting your permissions on your CGI scripts properly.

If you plan on running or linking to CGI scripts using the above method, set your permissions accordingly: CGI FILE -- 700 or (Owner=execute/write/read, group=nothing, world=nothing)

DATA FILE that the script writes to but is not viewed on the web) -- 600 or (Owner=write/read, group=nothing, world=nothing)

DATA FILE that the script writes to and is viewed on the web (example: guestbook) -- 644 or (Owner=read/write, group=read, world=read)

The above permissions will ensure MAXIMUM security.

Note: NEVER set your permissions on a file or directory to 777 as our server will not allow the script to execute because of the potential security hazard.

Back to the top.

Using the correct extensions for your CGI scripts.

If you are using a CGI script that you plan on being viewable by anyone (that creates output in the form of HTML), the script must have the .cgi file extension. If you try to do this with the .pl extension, it will not work.

The ..pl extension will work in all other cases. However, we strongly suggest you use and only use the .cgi extension for your Perl scripts. This is a good habit and will factor out any problems relating to your scripts because of the file extension used.

Back to the top.
Configuring your variables so that your CGI scripts will run properly.

Variables are the part of the script you must configure so that the script knows where your files are and where data should be recorded. Absolute paths and URLs will most likely be used in the variables, so you need to know what these are.

An absolute path is the path to a certain file or directory on the server. For example, the script might want to to set a variable ($links) to the absolute path to your links.cgi file. Below is what this should look like when configured properly.


The script may also ask for the URL to this file (links.cgi). If the variable were $linksurl, we would set it as follows.


CGI scripts obtained from free archives not made by you will almost always require you to set variables as we have done above. This is the most common source of problems with CGI scirpts not working properly, so make sure your variables are set correctly!

Back to the top.
Debugging your CGI scripts through Telnet.

One of the most powerful features of Telnet is that you can pinpoint problems in your CGI scripts. Unlike the HTTPD protocol which displays the infamous "Internal Server Error" message, telnet will tell you what is the real problem!

To test your script, you must execute it on the server, which means your permissions must allow you (the user) to execute the script. Otherwise, a permission denied message will occur.

Telnet into the directory where the script you wish to test resides. Lets say that the CGI script named "links.cgi" is giving us problems! To find the problem, type in "./links.cgi". The server will then execute the script and tell you what, if any problems occur. The syntax for this command is "./script_name".

After you have found the problem, you can edit your CGI script using PICO in Telnet, then test it again. Eventually you will get your script working, and much faster than trying to pinpoint the problem yourself!

Note: 95% of the time, the problem is either the permissions on the script(s) are not properly set or the scripts(s) variable(s) are not properly set.

Back to the top.
Other useful links to CGI/Perl tutorials.

The following list of websites offers troubleshooting and tutorials on CGI/Perl:
Back to the top.

Search the Support & FAQ Website



Home | About Us | Domain Name Registration | Place an Order | Package Plans | Support | Tutorials | Our Clients | Contact

  HelpQuest.Com for an Internet Presence with PIZZAZZ!

1999-2008 HelpQuest.Com. All Rights Reserved.