Frequently Ask Questions
CGI (Common Gateway Interface) Questions
- Where do I upload my CGI scripts to?
- What's the URL to the cgi-bin folder ?
- What permissions do I have to set on my CGI scripts?
- Where is Perl installed?
- Where is sendmail?
- What's an absolute path?
- What's a relative path?
- How can I easily fix common CGI errors?
- What's causing "Premature End Of Script" error and how can I fix it?
- What is "errno 2" error?
- Why do I get "Forbidden Access" when I try to run my CGI?
Where do I upload my CGI scripts to?
You upload them into cgi-bin folder which is located in your home directory.
contents | top
What's the URL to the cgi-bin folder ?
The URL to the cgi-bin folder is http://yourdomain.com/cgi-bin
So to access /web1/users/your_username/cgi-bin/script.cgi
use http://yourdomain.com/cgi-bin/script.cgi
contents | top
What permissions do I have to set on my CGI scripts?
The folder in which you place your CGI program should be chmoded to 755 ( web server will refuse to run if writeable permission is set for either group or other). The CGI program itself must be chmoded to 755.
contents | top
Where is Perl installed?
/usr/bin/perl and /usr/local/bin/perl
contents | top
Where is sendmail?
/usr/bin/sendmail
contents | top
What's an absolute path?
An absolute path is the path that starts with / ( root directory). Ex.: /usr/local/bin/perl If
a path does not begin with a forward slash, then it's called a relative path. Meaning, it's
relative to current directory.
contents | top
What's a relative path?
A relative pathname is the one that does not begin with a forward slash and is relative to some directory.
contents | top
How can I easily fix common CGI errors?
There are two most common problems with CGI scripts.
1. The very first line that specifies the path to Perl interpreter is incorrect
2. Permissions bits are set wrong
first line should say #!/usr/local/bin/perl or #!/usr/bin/perl
permissions on the perl scripts should be 755 (rwxr-xr-x)
contents | top
What's causing "Premature End Of Script" error and how can I fix it?
Your CGI program should send a header ( Ex. Content-type: text/html\n\n ) before sending any data back to the browser. If your script dies before sending required header, you'll get Premature End Of Script error. To correct it make sure your script outputs the right header beforeanything else.
contents | top
What is "errno 2" error?
You get this error when you upload file in the wrong format If you uploading text files you should use ASCII mode to transfer them to the server and NOT binary mode.
contents | top
Why do I get "Forbidden Access" when I try to run my CGI?
It is a permission problem. Check What permissions do I have to set on my CGI scripts?
contents | top
|