Kattare Internet Hosting Home | Home | Services | Contact Us | Order Online! |   whitespace image
  Kattare I/S: View FAQ Answer

| Webmail | Forums | News | FAQ | Members Login |  

whitespace image
tail end of the Kattare logo Toll Free: (866) KATTARE -or- (877) KATTARE
Local: (541) 753-1079
keyboard image for php hosting, jsp hosting, servlet hosting, java hosting website
Better Business Bureau Online  
whitespace image

   

whitespace image
greenspace image for php hosting, jsp hosting, servlet hosting, java hosting website

Home

Hosting Services

Server Co-Location
Dedicated Server
Java Servlet Hosting
Website Hosting
WHOIS Lookup
Join Us Today!

Members

Member Forums
Documentation
Kattare F.A.Q.
Free Software
Members Section
News
Referral System
Spam Blocking
Webmail

Development

Programming
Website Design
Graphic Design

Company

About Us
Contact Us
Our Network
Page Us
Sites We Host
Terms of Service


whitespace image
Documentation

Kattare is dedicated to making your hosting experience as painless as possible. That means making as much help and documentation available as possible.

Quick Links
[Frequently Asked Questions]
[User Forums]
[Howto's]
Category
CGI
Question

Last Modified: Oct 03, 2001

How can I make my CGI-scripts server independent?
Answer

If your scripts contain server-dependent code, that is, code which is specific to a particular server, you would need to rewrite code if you ever decided to move your site to a different web server. One such occasion would be if you decided to upgrade to or downgrade from a Corporate or other high volume account, since these accounts reside on high volume servers. Another occasion would be if you ever decided to reuse your scripts for other accounts, or give your scripts to other people. You should always try to write code that will run correctly regardless of what web server it runs on.

The most common kind of server-dependent code is code which accesses files or programs using an absolute path (such as "/home1/u/username/somefile"). Instead of using the absolute path to your home directory ("/home1/u/username/"), you should instead use the DOCUMENT_ROOT environment variable ($ENV{DOCUMENT_ROOT} in Perl) to determine the path of your files or programs within a script.

For example, if a guestbook script reads:

# Path to your guestbook file
$guestbook = "/home1/u/username/data/guest.html";

You should change it to:

# Path to your guestbook file
$guestbook = "$ENV{DOCUMENT_ROOT}/data/guest.html";

(Note: if you are writing scripts or recipes for use with procmail, you must use the HOME environment variable in place of DOCUMENT_ROOT. CGI environment variables are not available while running under procmail.)


[FAQ Main] [Submit a Question]

[Back to Category "CGI"]


whitespace image
green spacer Kattare Logo whitespace image
 
whitespace image
whitespace image