Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am fairly new with my new host GoDaddy coming from WebSiteHost.

With websitehost I was able to use DOCUMENT_ROOT to access the subdomain
files as if it where a main domain.

With GoDaddy I need to use SUBDOMAIN_DOCUMENT_ROOT to access the same
files on a subdomain.

I am assuming it is the way they have there web server configured.

My question is this, when I am developing on my local server I use
DOCUMENT_ROOT, but when I transfer to production I have to change my top
level includes.

Is there a way to set an enviroment variable or any other variable for
that sake in the php.ini that I can use globaly to point to the correct
doc root?

This will allow me to only change the ini instead of all the pages.

I am also VERY open to other options also.


Re: document_root

Quoted text here. Click to load it

I have this method to include files with relative paths:

$my_dir = dirname(array_pop(get_included_files()));
set_include_path(get_include_path() . PATH_SEPARATOR . $my_dir . "/..");

But maybe you have some reason to prefer absolute paths for your included

regards Henrik
The address in the header is only to prevent spam. My real address is:
hc3(at) Examples of addresses which go to spammers:
root@localhost postmaster@localhost

Re: document_root

Scott Johnson wrote:
Quoted text here. Click to load it

First recommendation, Scotty. Find another web host.  GoDaddy is good at
domain registration, but their hosting tech support stinks.  There are
plenty of good hosts who do not force you to jump through hoops to make
your site work.

If you can't change for some reason, create an include file.  On your
local system, have something like:

$syspath = $_SERVER['DOCUMENT_ROOT'];

On you website, the same file would contain:


Then use $syspath throughout your code.

You could also put something like this in a generic configuration file
which contains other things such as database information, etc.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: document_root

Jerry Stuckle wrote:
Quoted text here. Click to load it
Thanks Jerry

Actually I see your point about godaddy.  I have not been very happy
with the way their interface works let alone the configs.

Time to do some host research.


Re: document_root

Quoted text here. Click to load it

Does anyone else set SUBDOMAIN_DOCUMENT_ROOT?  If not, use
is true, otherwise use DOCUMENT_ROOT.  You'd put this logic in an
include file, but if it works, you wouldn't have to actually change

Re: document_root

Scott Johnson wrote:
Quoted text here. Click to load it

Thanks Henrik, Jerry & Gordon for your replies.

I can see the use for all of them for different situations. (*puts them
in his handy notebook).


Re: document_root

Scott Johnson escribió:
Quoted text here. Click to load it

I had a GoDaddy hosting account for a while (until I got fed up of 500
status code and poor support) and I wrote a little PHP snippet to fix
the value of $_SERVER['DOCUMENT_ROOT'] according to
$_SERVER['HTTP_HOST']. Then I'd load it transparently using the
auto_prepend_file PHP directive (at least, I had a custom php.ini to ply

My local dev site would not load such file so I could use the same code.

Another option, as others have suggested, is working with your own
variables. PHP constants come in handy.

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Site Timeline