Daniel Loose wrote:
Hello,
in order to use my scripts developed at home directly after upload, I
wish to define a variable $root at begin of each script in a way that
it always - be it here at home or on any other computer - contains the
correct path to the web docs directory. How shall I do that the best
way? (At least, how do I get the local IP or hostname? Or is there an
environment variable?) Grepped 4 thick books but nothing found...
TIA, Daniel
If I understand you right, .... what I do is look at the SERVER variable
HTTP_HOST.
if ($_SERVER['HTTP_HOST'] == 'localhost')
{
// the script is running on my home computer and not on the remote server
}
else
{
// $_SERVER['HTTP_HOST'] contains the domain name where my script is running
}
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*****************************