FAQ - CGI Scripts

FAQS - General
FAQ - Domain Names
FAQ - secure server
FAQ - CGI Scripts
FAQ - SSI

1. What is CGI?
2. How do I get to CGI access?
3. How do I go about using my CGI scripts?
4. What language do my CGI scripts need to be in?
5. Where can I get some CGI programs to use on my site?
6. What is the difference between CGI and JAVA?
7. Why am I getting a "Premature end of script headers" ,CGIwrap Error: System Error: execv() failed error or some other strange error?
8. My script is asking for a baseurl or basdir; what are they?
9. My script needs to know where sendmail is?
10. What scripts are in the public cgi-bin directory?
11. How do I use the FormMail script?

 

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, email forms, and shopping cart programs.

2. How do I get to CGI access?

Every account automatically comes with cgi access. 

3. How do I go about using my CGI scripts?

To use start using your cgi access, put your scripts in 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.  Make sure you change the file permissions to 755.  You can do this using CuteFTP by right clicking on the file name, and going to "change file attributes".

To call your script from a browser or an html page, use the following syntax:

http://yourname.com/cgi-bin/your script name>

4. What language do my CGI scripts need to be in?

Our server currently supports scripts written for Perl 5.0.1.

5. Where can I get some CGI programs to use on my site?

We offer a public gallery of scripts on our server located at www.blueguru.com/cgi_scripts.shtml

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 infamous "Premature end of script Headers" error. To fix this, check the following:

- Make sure that you are calling Perl correctly (#!/usr/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 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 blueguru.com, your base directory is /home/sites/<www.yourdomain.com>/web/cgi-bin/

For example, if your domain name is ford.com then you would insert the following into your webpage or script:

/home/sites/www.ford.com/web/cgi-bin/

BASEURL

The base URL usually refers to the URL to your website ex. http://blueguru.com

However, sometime there is a CGIURL which will refer to the URL that your cgi is accessed. Ex. http://blueguru.com/cgi-bin/script.here

9. My script needs to know where sendmail is?

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 you the contents of any form to you in email. We also have a counter script which will display a count of how many visitors come to your site. The counter has many nice features and can also display the date and time if you wish. Finally, we have installed an "Altavista-like" search engine that you can use to allow 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 email the contents of any form to an email address you specify.

The quickest way to get started is to insert the following code into your script:

<form action="/cgi/FormMail.pl" method="POST">
<input type="hidden" name="recipient" value="yourname@yourname.com">
<input type="hidden" name="subject" value="Put your email Subject Here">


...
...

</form>

More information about this script and it's other features can be found at Matt's Script Archive (FormMail Page).