web hosting
reseller hosting
  currently none

customer satisfaction
30 days unconditional money back guarantee for all 5 hosting packages!

Read what our customers have to say about us!

Searching for a webhost -
what should you look for?

A small list of things to
look for and help to avoid pitfalls!
Terms and conditions

© 2001-2003 hostproof
All rights reserved.
hosting done right

CGI / Perl / Sendmail / SSI
back to main support page
If you don't know a term we are using please take a look at our 'What is...?' page.

Where to place your CGI scripts
Although there is nothing dangerous about placing cgi scripts in random directories throughout your site, it's best if you keep them in their own little home known as the cgi-bin. This minimizes security risks and allows you to maintain your cgi programs from one directory.

The path to Perl
One of the first things you have to do when configuring a script is to set the correct path to the Perl interpreter (the engine responsible for processing the script). The path to Perl on our servers is: #!/usr/bin/perl

The path to sendmail
Some programs such as the ones, which send email will need to know where the Sendmail program resides on the server. The script will typically have a setting like this: $mailprog = '/usr/sbin/sendmail'; and will want you to set it appropriately. Sendmail on our servers can be found here: /usr/sbin/sendmail or /usr/lib/sendmail

Setting directories within your cgi scripts
When you configure a CGI script, it may ask you to set variables such as the base, relative, and CGI directory/url settings. Here's an example, using Matt Wright's script. Obviously, each script may vary, but this should provide you with some basic idea:
$basedir = "/home/yourusername/public_html/wwwboard";
$baseurl = "";
$cgi_url = "";

New to CGI?
Most scripts come with documentation on how to set them up. Please make sure you read and understand it before configuring the script. New to cgi? Here is a page with questions and answers to numerous questions evolving around the inns and outs of using CGI within your scripts: Another excellent site, which provides step by step chapters is:

Using Server Side Includes (SSI)
SSI works in conjunction with a web page usually with the .shtml extension. The .shtml extension tells the server to do something different with the web page. When you append the .html or .htm extension, this tells the server to "read" the page only. The .shtml extension tells the server to "Execute" the page, in addition to just reading it.
So, why would you want to execute the page? There are various commands you can program into a web page, which the server will look for and parse when the file is called as .shtml. In many cases, this mode is used in conjunction with Server Side Include (SSI) tags, to call a CGI script. For example, you have a visitor counter script, and we'll call it count.cgi. Every time someone visits your website, you want the script to be called, so that it logs the visitor into a file.

To do this, you would place an SSI tag into your web page. The tag in this case, would look something like:
<!--#exec cgi="/cgi-bin/count.cgi" -->
This small tag, which is hidden in the html coding of your page is telling the server to:

1. Go to the cgi-bin
2. Execute count.cgi

That's it! The information has been captured and processed by the count.cgi script. Of course, that's the short version of what happens. The long version would no doubt, would take us far beyond the scope of this document.
PLEASE do not use the .shtml extension on "all" of your web pages unless it's absolutely necessary. With a busy web site, this means that every page must be executed, as opposed to just read. This as you can appreciate, can add considerable memory and CPU load to the system. As always, read the instructions that came with your script carefully. They should provide specific instructions on how to configure the script, as well as the SSI tag

web hosting done right