Home
Search
Prices
Information
Renewals
Upgrades
Support
Terms
Contact Us
Domain Name Questions and Answers
Using Perl CGI Scripts

CGI is a protocol which allows programs to run on a web server to communicate with the viewers browser. CGI is short for "Common Gateway Interface". Most CGI programs are written in Perl, but they can also be written in C++, Java and Python etc. CGI can be used for many features, but is mostly used for counters and guest books. All TheName.co.uk hosting accounts come with the abilitly to use PERL5 cgi-bin scripts. Our servers use cgi-wrap technology for increased flexibility and security.

Essential Perl Script Information:

  • Scripts can run from anywhere
    On TheName.co.uk servers, CGI scripts may be located anywhere within your web folder. Your don't have to run scripts from a cgi-bin directory, although you may create a cgi-bin directory if you wish. Many people prefer to create a directory called 'cgi' and place all their scripts in there, but this isn't essential either as you can place scripts wherever you please.
  • Scripts MUST be uploaded in ASCII format
    All Perl scripts must be uploaded via FTP in ASCII transfer mode and not in Binary transfer mode. This is prevent them from becoming corrupt and failing to run. This is one of the commonest causes of script failure that we encounter, so always check that your CGI scripts are uploaded in ASCII transfer mode.
    If you are unsure, refer to the script's documentation, contact the script author or contact support .
  • Scripts MUST have the correct permissions
    Ensure your scripts are set as readable, writable and executable only by you - if you don't then the web server will not execute your CGI scripts. You must follow the following guidelines when setting permissions on CGI scripts:
    All CGI executable files (e.g. files ending in .pl, .cgi etc.) must have their permissions set to 755. You can do this in your FTP client with the chmod command. (See the section below on the chmod command).
    All files that need write access such as counter log files, message board files and guestbooks, should have permissions set to either 500 or 755.
    Any directories containing scripts should be set to 755.
    Please don't hesitate to e-mail us if you have a script problem which you feel is related to permissions or other server issues, we will do our best to advise you on the best permissions for a script.

The CHMOD Command

When you create/upload your CGI programs, you will need to change the access permissions using the chmod command. The chmod command consists of 2 properties, who will have privileges, and what privileges they have.

  1. Who will have privileges?
    There are 3 categories of who can have privileges, the User, the Group, and Others. They are represented by the characters u, g, and o. (The letter "a" represents all privileges).
  2. What privileges can people have?
    The 3 privileges (also known as permissions) are, "read", "write" and "execute". They are represented by r, w, and x. Privileges are assigned with an equals sign (=r, or =rw, or =rx), or added with a plus sign (+r, or +rwx), or subtracted with a minus (-w, or -rwx) The three digits in a chmod command like "chmod 755", refer to the values to be given to the owner, the group, and others.
    All of the three digits together, is the total values assigned for Read, Write, and Execute permissions.
    These are the individual values of the 3 permissions:
    Read = 4
    Write = 2
    Execute = 1
    Adding the numbers for each of the three permissions give you the individual group setting.
    Example
    If the owner is given read, write and execute permission, then the sum will be 4+2+1=7. If the group and others are given read and execute permission, then the sum will be 4+1=5. Therefore the chmod command for these permissions is "chmod 755"
    File permissions can be modified using most FTP clients.

Other Useful Information when using CGI/Perl Scripts

  • The path to the Perl interpreter is:
    /usr/bin/perl - all scripts should start with the shebang #!/usr/bin/perl
  • The path to sendmail is:
    /usr/sbin/sendmail

"Internal Server Error"? If your script fails to run you will see the above error message. This is generated automatically by the webserver and is one of the most unhelpful messages that the Apache Webserver generates since it is nearly always a script error that causes the Server Error.

Remember: Scripts will not run unless they have been uploaded in ASCI mode, the correct file and folder permissions are in place and the path to perl is correct. If you experience script errors then please check and double check that these setting are correct. They account for over 95% of CGI problems experienced by users. Try changing the permissions using the "chmod" command in your FTP client. If after extensive checking, look for errors in the script itself.

 

For more information see:

Uploading your Web Pages - detailed instructions on getting your site on line.
Email - how to use the e-mail part of your hosting account.
Control Panel - how to access our online control panel and set up new mail users.
Web Stats - about your sites web stats
Web Mail - how to access you POP mail using The Name Webmail
Advanced Hosting Information - How to set up cgi scripts, hidden directories and custom error pages.
Latest:
Free Web Mail
Host with thename.co.uk and get access to your e-mail from a browser completely Free!

Free Web Stats
thename.co.uk offers all hosting & forwarding customers Free visitor statistics - Vital for knowing how your site is performing

Hosting offers:
Hosting with thename.co.uk costs from just £3.75 per month. Each account comes with its own dedicated bandwidth quota, 25MB webspace, 15 Mail POP accounts and Frontpage extensions.