Infotx

Welcome to Infotx - Webmaster Guides and Resources.

Web hosting Control CGI/Perl.

CGI/Perl

 

Is there a limit on CGI script use?

 

Most hosting companies do not put limits on cgi scripts outside the use of malicious or harmful/damaging scripts.

 

 

What is the path to PERL?

 

The perl path is the very first line in every .cgi or .pl file. The path to the perl interpretor will be:

/usr/bin/perl -or- /usr/local/bin/perl

 

 

Can I add my own CGI scripts?

 

Our LINUX web servers have the capability to run CGI scripts in your own "cgi-bin" directory. Scripts may be written in Perl and CGI languages.

Here are some helpful tips to follow when installing scripts:

1. Upload to your cgi-bin directory to ensure proper file permission settings. All scripts on our server must have permissions set to 755 (rwx-rx-rx). If you need help in changing script permissions, please see the following:

2. Upload in ASCII transfer mode (and NOT BINARY mode)

3. The first line of each script must read: #!/usr/bin/perl

4. Ensure the permissions are set to 755

 

 

Do hosting companies have any cut-and-paste scripts available?

 

For your convenience, most hosting companies offer several simple scripts for use on your web site. The scripts include hit counters, mail forms, guestbooks, password protected subdirectories, searches, free-for-all pages and random link pages. It is advisable to test each script before beginning to edit its content. Programming knowledge is NOT necessary for the implementation of these programs.

CGI scripts are programs that run on the server. CGI stands for "Common Gateway Interface". These scripts can be installed to your site via your Account Control Panel located at http://yourdomain.com/cpanel under the 'CGI Center'.

 

 

What is the most common PERL coding error?

 

By far, it is using bad paths. To be safe, you should always try to use full path names and
make sure that the files you are manipulating/accessing are there and have the proper
permissions set.

 

 

Understanding CGI Basics

 

Understanding the Basic of CGI

Q. What Is CGI and how is it going to help me?
A. CGI is translated as Common Gateway Interface. It's used to provide interactivity and turn static pages into dynamic ones. What do I mean? Let's take a guestbook for example. Most of them are powered by CGI. They allow your visitors to leave their comments on your site. This makes it interactive. But guestbook is only one example. You also have bulletin boards, form processing, counters, and much more.

Q. How am I supposed to install a script?
A. Usually 95% of the scripts that I have tried before have complete instructions and a special ReadMe file with everything you need to know about installing that script. I recommend you reading the instructions a few times before starting to install the script. This will help you to make less mistakes.

Q. What does "chmod" mean?
A. To chmod a file means to set a certain permission. Few of the most common chmod commands are 775 and 777. To chmod a certain file or a category using FTP client find something like "Change File Attributes" and enter the chmod command script instructions tell you. If you are using Telnet, here are a few commands that you should use in order to chmod a file or a directory:

u = the file's user (or owner)
r = read access
g = the file's group
x = execute access
o = others
w = write access
a = the user, the group, and others.

Q. What are the most common errors and how do I deal with them?
A. One of the most common errors is "500 Internal Error". The chances are that you will experience it many times. The worst thing about it, is that it doesn't actually tells you what's wrong with the script. It only tells you that something isn't right. There are several possibilities that make up 99% of this error. Here they are:

* Incorrect path to PERL. See the next question for more information
* Syntax error. Check and see if you didn't accidentally deleted a command or a word that the instructions didn't tell you to.
* Incorrect CHMOD command. Make sure that you chmod the file exactly as the instructions say. Most of the times it will be either 755 or 777 (not always!). You can also get an "Access Denied" error, if you didn't chmod the file or a directory correctly.

Basically, 500 Internal Error and Access Denied are 99% of errors you'll experience. And 99% the cause of the error, will be one of the above.

Q. What is the path to PERL (interpretator)?
A. The perl path is the very first line in every .cgi or .pl file. Usually it looks something like this #!/usr/bin/perl. Make sure that the path is correct, otherwise you'll get an error. If you don't have the telnet access, simply email your tech support and ask them.

 

 

Formmail will not send from an email address other than my main account.

 

This script is old, and does not conform to current protocols for sending email. To have the sender of the email be anything different, you will need to use a different form processor. Here is a url to a collection of several different form processing scripts:

http://cgi.resourceindex.com/Programs_and_Scripts/Perl/Form_Processing/

 

 

Why am I getting 'File Not Found' when executing my CGI script?

 

"File Not Found" or "No Such File or Directory"

This is usually the result of CGI scripts being uploaded the wrong way.
PERL is an interpreter and it wants text files to interpret. No compilation is
done. So when people upload their scripts they need to be in ASCII mode.
Not binary, and not automatic. ASCII mode. ASCII mode should be used for all
text files and binary for things like .jpg's .zip's and such.

Also make sure they know that Linux is a case-sensitive OS--so if the file they
want is Marmot.html and their script looks for marmot.html then it's going to fail to
find it.