Install CGI Scripts

How To Install CGI Scripts

To install CGI scripts, first thing you need is a web server that support CGI scripting language like Perl.

Uploading Files to Web Server

CGI scripts are text files, these need to be transfered to your web server in ASCII mode. Transfering files from your local computer to remote web server can be done in two ways, ASCII and BINARY mode. You must upload all your Perl CGI scripts in ASCII mode. This is because, text file format varies betwen Linux, Windows and Mac. So by using ASCII mode, FTP program will take care of file convertion.

You can use any FTP program to upload files to your web server. If you don't have a FTP program installed on your computer, you can use WebFTP available at

There are many free and paid FTP client software available. You can find a list of FTP Programs at

Configuring Perl Script

Once you have the Perl script that need to be installed, you need to configure it before uploading to the web server. Each perl script is different, so to know how exactly this is done, you shoule refer the readme.txt or documentation file provided by the script author.

Most web servers allow you to run Perl scripts with .pl and .cgi extension. Perl CGI scripts are run with an external executable, called the perl interpreter. This is specified in first line of the Perl script.

First line of any Perl CGI script is called shebang line. This specify the location of perl installed in the web server. So you need to edit your perl script with any text editor and put correct path to perl on your web server. For most of the servers, the default value will work fine. If perl is installed in a different location on your web server, you need to modify the path.

To find location of perl in your web server, contact your web hosting provider, if you have SSH access, you can find it yourself with "which perl" command. Popular control panels like Cpanel will provide the path in your control panel. If your web server use standard control panel like cpanel, chances are, you already have the correct path to perl in your CGI script.

You will find first line of perl script start with #!, this line is called shebang line. If perl is installed in /usr/bin/perl, your first line will look like #!/usr/bin/perl

Perl Variables

Variable in perl start with $ and array start with @. For example $myvar is a variable. @myarray is an array. Variable can be defined in two ways.

$variable = 'What is your name';
$variable = "What is your name";

Once you have done the configuration as perl the script documentation or install guide, you need to upload all files to your web server. Make sure all .pl, .cgi files uploaded in ASCII mode.

Making CGI Scripts Executable

Once you have uploaded all your files, you need to change file permission. You need to refer script documentation to know what perlmission is needed for each files.

Most .pl, .cgi script need permission 755 (chmod 755 filename) and files that need writable to public/webserver need permission 777. You can set permission of a file with most of the FTP client software or chmod command in SSH.

Get in touch with us

Questions? Concerns? Comments? We want to hear from you!
Drop us a line with whatever is on your mind and we will get back to you ASAP!!