Install CGI Scripts

By David Nelson

The first thing you need when installing cgi scripts is an ftp program. I use WS FTP Light Edition, which is available for free download from http://ipswitch.com. After downloading that, install it by double clicking the file you downloaded.

A Perl CGI script is a text file with code in it that calls an external executable, called the perl interpreter. The first line of each .cgi or .pl file in the distribution for the cgi script you want to install needs to have the correct path to perl.

You need to either ask your web host what the path to perl is.

Typical paths are:
#!/usr/bin/perl
#!/usr/local/bin/perl
#!/bin/perl

After you�ve edited all your .pl and .cgi files to start with the correct path to perl, you need to edit a few other things. Good cgi script authors will include a config file with the variables the program uses. Unfortunately, most cgi script authors don�t do this, so you�ll need to edit the actual code in your program to adjust settings to reflect your system.

Configuration variables in perl scripts take 2 forms - single quotes and double quotes.

Single quotes look like this:

$variable = 'some value here';

Double quotes look like this:

$variable = "some value here"

For our purposes, they are the same with one difference. In the double quoted form (which is commonly used, you must escape the @ sign when specifying an email address.

So if you see:

$email = me@mysite.com;

that is wrong and will throw an error. You need to put:

$email = "me\@mysite.com";

instead.

If the variable is in single quotes, you do NOT want to include the escaping backslash. So this is correct:

$email = 'me@somehost.com';

whereas this is incorrect:

$email = 'me\@somehost.com';

The important part is if you have a variable in single quotes, you don�t need to escape the @ with a backslash, and if the variable is in double quotes, you must escape the @ with a backslash.

After opening the script or config file, you�ll typically see many configuration variables. A lot of times, scripts ask for your document root, or have something that looks like this:

$path = "/path/to/document_root/htdocs/myfolder"

In this situation, you need to change the "/path/to/document_root" to whatever your document root path really is. Your web host will have that information for you.

Another common configuration variable is the path to sendmail on your system. You�ll need to ask your web host this too.

Some cgi scripts require mysql database login information, such as your database name, database username, and database password. Again, ask your web host what this information is.

Now that you�ve edited all the configuration variables, you need to FTP all the appropriate files to your server. You MUST transfer .cgi, .pl, .txt, and .html files as ASCII text. Only upload images (.jpg, .gif, .png) and binaries (.exe) as BINARY. This setting is in a radio box at the bottom of the WS FTP LE user interface.

Once all files are uploaded in the correct locations according to where the installation document your cgi script provides, you need to right click on all .cgi and .pl files in WS FTP LE, and then click �chmod�. After clicking chmod, you�ll see three rows and three columns (columns are vertical) of checkboxes. For the first column of checkboxes, check them all. Then for the second and third column of checkboxes, check the top and bottom checkboxes only. This means you are giving permission to user to read, write and execute, group to read and execute, and all to read and execute. This is represented by the code 755 in some FTP clients. It�s called a �chmod 755�, and makes your program files executable on the remote server.

Once this is done, your script should be working. If not, put this line at the top of the script right under the #!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);

This will cause your program to print all error messages to your web browser when you try and load the program from it, and can help you debug an installation.

It is important to save all your files from your cgi script in unix line feed format. A good text editor like Textpad (http://textpad.com) will let you do this.

If you are getting 500 Internal Server Errors even after doing the above two steps, check your error_log file. Your web host can tell you where your error_log file is. This file will have further information about what is going on in your script.

Some cgi scripts will require you to pull up a configuration program cgi script from your web browser to further configure settings. At this point, just follow the steps that show up in your browser, and fill in the blanks.


Ecommerce Shopping Cart Software
ShopCMS Paypal Shopping Cart
Free CGI Scripts
CGI Tutorial
Software Engineering Consultant
Search Engine Optimization Tips
How To Choose Quality Web Hosting
Free Search Engine Ranking Software
HTTP Compression
Install CGI Scripts
Tell A Friend Script
LittleFTP Free FTP Client For Windows


Link To
This Page!


Copy the following code and paste it into your html file.
Ecommerce Shopping Cart Software | ShopCMS Paypal Shopping Cart | Software Engineering Consultant | Free Search Engine Ranking Software | HTTP Compression | Install CGI Scripts | Search Engine Optimization Tips | CGI Tutorial | CGI Scripts | How To Choose Quality Web Hosting | Tell A Friend Script