Contact Form Processing Products - for all your needs

FormMail • Form Encryption • Hosted Forms

SET_REAL_DOCUMENT_ROOT Setting

This page documents the SET_REAL_DOCUMENT_ROOT configuration setting in FormMail.

Type Of Setting

SET_REAL_DOCUMENT_ROOT is an OPTIONAL setting, which means...

OPTIONAL : you can change this setting if you need to, but the default value is fine for most circumstances.

Précis

Server Document Root.

Description

SET_REAL_DOCUMENT_ROOT tells FormMail the Document Root for your website.

The Document Root is the top folder or directory on your webserver where you can place HTML documents. It's often called "public_html" or "www". Its name and location differs between servers and hosting providers.

REAL_DOCUMENT_ROOT is the global FormMail variable that's used to refer to your Document Root. FormMail tries to set REAL_DOCUMENT_ROOT automatically. The SET_REAL_DOCUMENT_ROOT configuration setting allows you to force the correct value.

Note that FormMail only uses REAL_DOCUMENT_ROOT for setting the FILTERS and SOCKET_FILTERS values. Therefore, you do not need to set SET_REAL_DOCUMENT_ROOT if you are not using filters.

Automatically finding the document root for your website in PHP can be quite problematic. The PHP global variable $_SERVER["DOCUMENT_ROOT"] is often correct, but sometimes it's not provided by PHP (e.g. with a CGI interface) and with certain secure server configurations, it's completely inappropriate.

For example, a website at http://www.yoursite.com/ might also live at https://secure.yoursite.com/~yoursite/. If you run FormMail from the latter location (such as when you place an order) $_SERVER["DOCUMENT_ROOT"] may be set to "/home/secure" - which is completely wrong and won't work. In these cases, you can use SET_REAL_DOCUMENT_ROOT to ensure FormMail knows your document root regardless of the way it's accessed.

FormMail uses some logic (in a function called SetRealDocumentRoot) which is designed to set REAL_DOCUMENT_ROOT to the right value based on the setting of SCRIPT_FILENAME or PATH_TRANSLATED (or as a last attempt, DOCUMENT_ROOT).

The logic in the SetRealDocumentRoot function should work on most servers in most situations. However, it might not work on your server.

Therefore, you can set SET_REAL_DOCUMENT_ROOT to the correct value for your website.

Use an absolute directory pathname such as:

$SET_REAL_DOCUMENT_ROOT = "/home/yourname/public_html";
$SET_REAL_DOCUMENT_ROOT = "d:/inet/user/htdocs";

NOTE: on Windows servers, use '/' instead of '\' or double the '\' like this:

$SET_REAL_DOCUMENT_ROOT = "d:\\path\\to\\document_root";

or

$SET_REAL_DOCUMENT_ROOT = "d:/path/to/document_root";

Default Value

$SET_REAL_DOCUMENT_ROOT = "";

See Also