Each WEBVISIONS Virtual Server provides you with the ability to create
multiple cgi-bins and launch cgi scripts from any of these cgi-bins within
your
server. This document here provides you with more information on how
you can install your own cgi-scripts.
Perl Locations
For those installing perl scripts, perl v5 can be referenced at
/usr/local/bin/perl or
/usr/bin/perl
Other Common File Locations
If sendmail is required in your scripts, it can be found at
/bin/sendmail
Referencing your scripts
Assuming you have your scripts installed in your root cgi-bin, you
can have it referenced at
/usr/home/LOGIN/cgi-bin/scriptname.cgi .
Otherwise, if your script is located in a sub-directory in your "www"
folder,
reference it as
/usr/home/LOGIN/www/SUB-DIRECTORY/cgi-bin/scriptname.cgi
Replace "LOGIN" & "SUB-DIRECTORY" accordingly.
Setting Permissions
After you have uploaded your script or have created it on-line,
make sure you give the script permission to execute. In a UNIX
environment, each file has a specific mode or set of permissions
which determine who can read or write to the file as well as who
can execute the file (if anyone). Setting the "execute bit" on a file
is easy to do. You can either do this via FTP, WebShell or you can telnet
or
SSH to your Virtual Server and type the command "chmod +x
FILENAME", where FILENAME is the name of your script. If a
script does not have execute permissions, your web server will
report a "403 Forbidden" server error when it attempts to execute
the script.
Common Problems with Perl Scripts
- Failure to upload your perl script in ASCII mode.
Perl scripts, unlike compiled executables, are
plain text
files. Plain text files should be transferred from
your local
computer to your Virtual Server using ASCII mode
(not
BINARY mode). Failure to transfer your perl
scripts to your
Virtual Server in ASCII mode may result in 500
Server
Errors.
- Improper path specification of perl interpreter.
The first line of a perl script indicates the path
name of the
perl interpreter. In the Virtual Server
environment, the
correct specification of your perl interpreter is
"/usr/bin/perl". If you downloaded a perl script
from a
third party source, the perl interpreter is most
often defined
based on the author's host environment which may
be
different from the Virtual Server environment
(/usr/bin/perl is a fairly common however).
Troubleshooting 500 Server Errors
If you encounter the popular "500 Server Error" when you
execute your scripts, you can diagnose the source of the problem
via your web server's error log. Your webserver's error log
can be found at
/usr/home/LOGIN/logs/error.log .
To view your server error.log file, you can either use WebManager
or telnet (or SSH) into your server and perform the following steps:
cd logs
tail -f error.log
The tail command displays the last part of error log file
and will print anything appended to the error log file to.
Some common Errors
Error: HTTPd: malformed header from script [CGI PATH INFO]
Analysis and Solution:
Your script is not printing out a proper header response.
When a CGI is executed, it communicates back to the web
server a message which is divided into two parts: the header
and the body. The header typically tells the web server the
"content type" of the data that will be sent as the body of the
response. The header and body are separated by a single
blank line. An example of a CGI response is shown below:
Content-type: text/html\n\n
<html>
<head><title>Title</title></head>
<body bgcolor="white">
Hello world!
</body>
</html>
The "malformed header from script" error message
indicates that your script is not properly returning the header
portion of the response. You may not have misspelled
"Content-type", not supplied a valid type (such as
"text/html"), or failed to print out a blank line to separate the
header from body of the response.