Frequently Asked Questions - CGI/PERL Scripts
Note: US Net Web servers use CGIWrap
CGIWrap is a gateway program that allows users to use CGI scripts
and HTML forms without compromising the security of the http server.
Scripts are run with the permissions of the user who owns the
script. In addition, several security checks are performed on
the script, which will not be executed if any checks fail.
1. What is CGI?
CGI stands for Common Gateway Interface.
CGI programs are run on the Web server to enhance the abilities
of Web pages, thus making them less static. Example: CGI programs
are counters, e-mail forms, and shopping cart programs.
2. How do I get to CGI access?
Your cgi access has already been activated
when your account was set up.
3. How do I go about using my
CGI scripts?
To use, initiate your CGI access, place your scripts into your
/cgi-bin directory located in your
home directory. You may also use subdirectories that branch
off of your cgi-bin directory if you need. To call your
script from a browser or an html page, use the following syntax:
http://yourname.com/cgi-bin/cgiwrap/<your
login name>/<your script name><your login name>
refers to the login name you use to upload your site.
4. In what language do my CGI
scripts need to be?
Our server currently supports scripts written
for Perl 5.0.1.
5. Where can I get some CGI
programs to use on my site?
The CGI RESOURCE INDEX has over 1500
cgi resources. They are located at www.cgi-resources.com
6. What is the difference between
CGI and JAVA?
CGI is a scripting language that is run
locally on the server and uses the servers resources to run your
program. Java is a programming language that runs on almost
any platform. Java is either embedded as a script in the Web
page itself or it is a compiled program that is downloaded and run
locally on the users computer.
7. Why am I getting a "premature
end of script header" or other errors?
The major error you will see when calling your script will be
the "Premature end of script Headers" error. To
fix this, check the following:
- Make sure that you are calling Perl correctly (#!/usr/local/bin/perl)
many times scripts call it with a
(!#/usr/bin/perl). You will find this line usually
at the very top of your script.
- Be sure that you have uploaded your cgi script(s) in ASCII mode,
NOT binary. CGI scripts are text files that need to be uploaded
in ASCII format.
8. My script is asking for a
baseurl or basdir; what are they?
Many scripts need to know the working directory,
(the directory that your script executes in) or the URL
of your script.
BASEDIR
On US Net, your base directory is /usr/local/www/htdocs/<login
name>/cgi-bin/
For example, if your login name is someone then you would insert
the following into your webpage or script:
/usr/local/www/htdocs/someone/cgi-bin/
BASEURL
The base URL usually refers to the URL
to your website
For example, http://www.us.net
However, sometime there is a CGIURL which will refer to
the URL that your CGI is accessed.
For example, http://www.us.net /cgi-bin/cgiwrap/<username>/script.here
9. My script needs to know the
location of sendmail.
Sendmail is located at /usr/lib/sendmail
10. What scripts are available
in the public cgi-bin directory?
We currently have a FormMail script which
will send the contents of any form to you in e-mail. We also
have a counter script which will display a count of how many visitors
come to your site. The counter has many useful features and
can also display the date and time if you wish. Finally, we
have installed an Excite search engine that you can use to enable
visitors to search your website.
11. How do I use the FormMail
script?
The FormMail
script is a script created by Matt
Wright, that will e-mail the contents of any form to an
e-mail address you specify. The quickest way to get started
is to insert the following code into your script:
<form action="/cgi-bin/FormMail.pl"
method="POST">
<input type="hidden" name="recipient" value="yourname@yourname.com">
<input type="hidden" name="subject" value="Put
your e-mail Subject Here">....
....</form>
More information about this script and it's other features can
be found at Matt's
Script Archive (FormMail Page).
12. How can I use the public
counter program?
US Net uses a digital counter program called WWW
Count designed by Muhammad
A. Muquit and Kevin
J. Walsh. You will first need to go to our members
section or type http://yourdomainname.com/userconsole
and add your counter. Also, you can get started easily by
inserting the following code into your HTML page
<img src="/cgi-bin/Count.cgi?df=yourname.dat"
align=absmiddle>
Then, you will see a counter similar to this: This page has been
accessed
times. More information on changing the digit styles and
displaying the date and time are available at the WWW
HomePage Access Counter.
13. How do I install the Excite
search engine for my site?
To install the Excite search engine you
will need to go to our members section or type http://yourdomainname.com/userconsole
and install the search engine.
14. Can I restrict which directories
are searched?
Yes, in your home directory you will find an excite.filter
file. This file must exist at all times, so DO NOT DELETE
IT or your site will not be indexed each night. To exclude
certain files or directories from being indexed, enter the following
in your excite.filter file:
subdir cgi-bin (Prevents the
cgi-bin from being indexed)
file private.html (Prevents your
private.html file from being indexed)
15. I still need help
where can I get it?
Just e-mail support@us.net
if you would like help with your search engine. Please include
your domain name in this e-mail and a detailed description of your
problem.
16. I am getting a 500 server
error, how can I debug my script?
CGIwrap supports a debugging mode which
can help to debug scripts. To use it, call CGIwrap via the
URL http://yourname.com/cgi-bin/cgiwrapd/<your
login name>/<your script name>. Note: cgiwrapd
is used instead of just cgiwrap.
|