Kattare Internet Hosting Home | Home | Services | Contact Us | Order Online |   whitespace image
  Kattare I/S: View FAQ Answer | Webmail | 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  whitespace image
You've got Q's? We've got A's.  whitespace image
greenspace image for php hosting, jsp hosting, servlet hosting, java hosting website

Home

Contribute Hosting!

Hosting Services

Java Hosting
  JBoss Hosting
  JSP Hosting
  GlassFish Hosting
  Servlet Hosting
  Tcat Hosting
  Tomcat Hosting

Standard Hosting
  Perl Hosting
  PHP 4 Hosting
  PHP 5 Hosting
  Ruby Hosting

Dedicated Servers
Server Co-Location

Domain Lookup
Join Us Today!

Members

Control Panel
  Ticketing
  Webmail
F.A.Q.
Recent News
Referral System
Spam Blocking

Company

About Us
  History
  Privacy Policy
  Sites We Host
  Strategic Partners
  Terms of Service
  Trademarks
Contact Us
  Phone / Fax
  Mail / Email
  SMS Text


Verify Kattare Internet Services

Documentation

Kattare is dedicated to making your hosting experience as painless as possible. That means making as much help and documentation available as possible. If you have a question that you think would be helpful to have here, please [Submit your Question].

Quick Links
 [Getting Started
 [JSP & Java
 [Ruby & Rails
 [Email & Webmail
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

 [Getting Started]  [JSP & Java]  [Ruby & Rails]  [Email & Webmail]

Kattare Logo
whitespace image
 
whitespace image
whitespace image