| We cannot offer technical support
for scripts that we do not provide. So if you are not already
familiar with CGI scripting, you may want to read a book on
the subject or find places on the Internet with CGI scripting
information. There are many good resources for CGI scripts
found on the web.
You should consult the party that original provided your script
for assistance or visit:
Other helpful cgi resources on the web can be found at:
http://www.cgi-resources.com
http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html
http://hoohoo.ncsa.uiuc.edu/cgi/overview.html
http://www.cgi-perl.com
Below are solutions to some of the more common CGI script
problems, in question and answer format.
When I activate my CGI program, I get back a page that says
"Internal Server Error. The server encountered an internal
error or misconfiguration and was unable to complete your
request."
This is generally caused by a problem within the script. Log
in via Telnet and test your script in local mode to get a
better idea of what the problem is. To do this, go into the
directory in which your script is located, then execute the
script. To execute the script, you can do it by two ways:
1) Type "perl myscript.pl" (Perl being the language
interpreter in this case).
2) Or simply type "myscript.pl" alone, that will
work if the first line is well written to indicate the location
of Perl.
The first one is useful to see if there's any error IN your
script. The second one is useful to test if your "calling
line" (the first line of the script) is okay, i.e. if
you entered the right location of Perl.
Cgi-bin scripts and executables must have the proper permissions
or an internal server error will occur. The directory (and
all the cgi's within it) must NOT be world writable. This
is the most common error.
See
http://www.apache.org/docs-1.2/suexec.html for more details.
I am being told "File Not Found," or "No Such
File or Directory."
Upload your Perl or CGI script in ASCII mode, not binary mode.
When I test my Perl script in local mode (by Telnet), I have
the following error: "Literal @domain now requires backslash
at myscript.pl line 3, within string. Execution of myscript.pl
aborted due to compilation errors."
This is caused by a misinterpretation by Perl. You see, the
"@" sign has a special meaning in Perl; it identifies
an array (a table of elements). Since it cannot find the array
named domain, it generates an error. You should place a backslash
(\) before the "@" symbol to tell Perl to see it
as a regular symbol, as in an email address.
I am getting the message "POST not implemented."
You are probably using the wrong reference for cgiemail. Use
the reference /cgi-bin/cgiemail/mail.txt. Another possibility
is that you are pointing to a cgi-bin script that you have
not put in your cgi-bin directory. In general, this message
really means that the web server is not recognizing the cgi-bin
script you are calling as a program. It thinks it is a regular
text file.
It's saying I don't have permission to access / (1)
This error message means that you are missing your index.htm
file. Note that files that start with a "." are
hidden files. To see them, type ls -al. If you wish to FTP
this file in, go to the home/[[yourdomain]] directory.
It's saying I don't have permission to access/ (2)
Your cgi-script is probably set as world writable. Our cgi
scecurity mechanism prevents execution of such cgi-scripts.
To ensure that the permssion setting for your cgi-script is
correct issue following command.
"chmod 755 yourcgiscript " in the directory where
your cgi-script is located.
Also the directory in which your script is located must be
set to same permission setting. Use same method as described
just above.
.htaccess Modifications
We do not offer support for .htaccess modifications. The following
examples will work on our systems and we offer them as a guide
for our customers. Complete documentation can be viewed at
http://www.apache.org/docs/mod/mod_rewrite.html and
http://www.engelschall.com/pw/apache/rewriteguide
WARNING FOR FRONTPAGE USERS: Any modifications to your .htaccess
file may result in the corruption of your extensions and as
a result may make your site inaccessible. One should create
a backup copy of your .htaccess file before any changes are
made to the .htaccess file
The .htaccess file is a document created in ASCII text that
can be placed in any directory in your account. The file can
be used to customize some some server operations in your account
and control access to specific files and directories. One
can create an .htaccess file can using any word processor
application but must be saved in text only format. Once the
.htaccess file is created it must be uploaded to your account
using an FTP application in ASCII mode. For the examples provided
below, please place the .htaccess file in your www directory.
Custom Error Messages
Add the following to the .htaccess file:
ErrorDocument 404 /notfound.html
After "ErrorDocument" specify the error code, followed
by a space, and then the path and filename of the .html file
you would like to be displayed when the specified error is
generated.
Denying User Access
Add the following to the .htaccess file:
<Limit GET>
order allow,deny
deny from 128.23.45.
deny from 207.158.255.213
allow from all
</Limit>
This is an example of a .htaccess file that will block access
to your site to anyone who is coming from any IP address beginning
with 128.23.45 and from the specific IP address 207.158.255.213
. By specifying only part of an IP address, and ending the
partial IP address with a period, all sub-addresses coming
from the specified IP address block will be blocked. You must
use the IP addresses to block access, use of domain names
is not supported.
Redirect a Machine Name
Add the following to the .htaccess file:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Rewrite Rule for machine.domain-name.net
RewriteCond %{HTTP_HOST} machine.domain-name.net$
RewriteCond %{REQUEST_URI} !machine/
RewriteRule ^(.*)$ machine/$1
This will redirect requests for the machine name machine.domain-name.net
to the directory machine on the site domain-name.net.
Different Default Home Page
Add the following to the .htaccess file:
DirectoryIndex filename.html
Then a request for http://domain-name.net/ would return http://domain-name.net/filename.html
if it exists, or would list the directory if it did not exist.
To automatically run a cgi script, add the following to the
.htaccess file:
DirectoryIndex /cgi-local/index.pl
This would cause the CGI script /cgi-bin/index.pl to be executed.
If you place your .htaccess file containing the DirectoryIndex
specification in the root directory of your site, it will
apply for all sub-directories at your site.
v Preventing People from Linking to Your Images
Add the following to the .htaccess file:
# Rewrite Rule for images
RewriteCond %{HTTP_REFERER}
RewriteRule ^(.*)$ http://
You would replace the <URL of page accessing your domain>
above with the domain name and path of the page that is referring
to your domain. For example: www.their-isp.net/users/mypage/
The RewriteCond directive states that if the {HTTP_REFERER}
matches the URL that follows, then use the RewriteRule directive.
The RewriteRule directive will redirect any reference back to
the referring web page. Displaying a directory of
items in a directory without a index.htm page
Add a blank index.htm file to each directory
Add a file called ".htaccess" (no extension). The
contents of this file should be one line as follows:
Options +Indexes To add a mime-type to your account,
you can use the .htaccess file:
Use this format:
AddType mime-type extension
The .htaccess usually would reside in your "www" directory.
For example:
The entry for a file with the extension *.psd which is a Photoshop
document would be:
AddType image/x-photoshop PSD
**If there is no .htaccess file in your "www" you
can create one inany text editor. You will only need to enter
the above example for your mime type.** |