Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Scott Johnson
October 10, 2009, 6:01 pm
rate this thread
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
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
This will allow me to only change the ini instead of all the pages.
I am also VERY open to other options also.
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
The address in the header is only to prevent spam. My real address is:
hc3(at)poolhem.se Examples of addresses which go to spammers:
Scott Johnson wrote:
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:
$syspath = $_SERVER['SUBDOMAIN_DOCUMENT_ROOT'];
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
JDS Computer Training Corp.
October 13, 2009, 7:49 am
Scott Johnson escribió:
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.
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com