Maxi Website Hosting FAQ

What is CGI? What is my path to Perl? etc..

1.  What is CGI?

CGI stands for Common Gateway Interface. It is simply how the web server communicates with a script or other software on the server itself. It is not a programming language such as Perl, C++, or Basic.

top of page

A CGI-BIN directory is a directory on a server that will allow the execution of a script or other software through the World Wide Web. Generally it is the only location on a server that will allow this. You cannot just create this directory on your web server and expect it to work. It must be activated by the web server software you are running.

However, on some servers (especially NT) scripts can be executed anywhere. It is up to how your server is setup

top of page

When adding new files such as CGI, Perl, etc. it is necessary to set specific permissions for the script to work.

The UNIX directory and file structure has a system of permissions. You have permission to read a file, you have permission to write to a file, and finally, you have permission to execute a file. However, you are not always you. Unix splits identities into three categories. The first is you, the owner of the file. The second is the group you belong to. And third, others is the world, basically anyone who comes to your website.
To change permissions you must issue a "change mode command", or more commonly referred to as the UNIX command "chmod". The documentation for your file or script will usually come with the proper permissions you need to set for your program to work. To set permissions, there are basically 2 methods UNIX recognizes.

With FTP (and Telnet) your file properties are shown as -rwxr-xr-x.
The first space designates if this is a directory by the letter "d".
The next three characters designate the permissions for the "owner", r = read, w = write, and x = execute if the permission is set to "on" and "-" is the permission is set to off.

Permissions for the "group" and "world" (other) are designated by characters 5-7 and 8-10 respectively.

The second method we are calling the alpha method because permissions are set, by way of a telnet session, using alpha characters. You simply specify with the group or groups whose settings you want to change ("u" represents "user" or you, "g" represents "group", "o" represents other or world and "a" represents "all") and all the settings you want to change ("r" for read access, "w" for write access, and "x" for execute access). To set your file world-writable, you would type "chmod o+w ". To set it executable to everyone, you would use "chmod a+x ". The plus sign indicates you're adding permissions. You can use a minus sign to remove permissions.

top of page

The path to Perl tells your script where to find the Perl processing program on your server. This line should read:


top of page

Sendmail is the program that allows a script to send e-mail. This line should read:


top of page

Yes. All pages that utilize SSI must be named with the extension


In order to use SSI's use the format "include file" or "include virtual" as the tag command.


(!--#include virtual="/cgi-bin/filename.cgi"--)

top of page

This is a common error found in a Web browser when you are attempting to run a Perl or CGI script that has problems. The three most common reasons for this error are the following:

       1. Your script permissions are set wrong. Try setting them to 777 temporarily while troubleshooting the error.

       2. Your script was uploaded in binary file format instead of ASCII. You must upload Perl and CGI scripts in ASCII format only.

       3. Your path to Perl line is wrong.

The very first line in your Perl program must be "#!/usr/bin/perl". You cannot have any spaces between your characters, and you cannot have any hard returns or text lines before this line.

If none of these three reasons correct your errors, then you may want to take a look at your Error Log files. If the script is coded to print the errors it encounters, these will be displayed in your Error Log file of your server.

If all else fails, you can usually find the script errors by logging in to your server via Telnet and running the script from the command line. Once you are logged into the server, you must change directories until you are in the one in which your script resides. At that point, type the following at the command line:

perl filename.cgi -w

Note: There should be one space after the word "perl". "filename.cgi" should be the actual filename of the script you are having problems with. "-w" is a warning switch, this will prompt Perl to give you any errors it sees in the script and it will give the line number that the error is on or near.

top of page

Perl is a programming language that was developed by Larry Wall and is relatively easy to learn. It is an interpreted language which means that the source code must be read by the Perl runtime each time it is executed. So, any machine with the Perl interpreter can run Perl scripts.

top of page


Helene Solinga

Maxi Website Hosting
P.O. Box 709
Putnam Valley, NY  10579