John Nichel wrote:
Jeremy Privett wrote:
John Nichel wrote:
$_SERVER['DOCUMENT_ROOT']
http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server
Nope. I've already tried that... $_SERVER['DOCUMENT_ROOT'] contains
/home/jeremy/public_html/test/ ... All I want is to the public_html
part.
'DOCUMET_ROOT' will return what the web server's document root is, no
matter what directory on that web server the script is run.
ie, I'm running apache, look here....
http://www.nichel.net/docroot.php
http://www.nichel.net/test/docroot.php
http://www.nichel.net/bob/docroot.php
http://www.nichel.net/bob/fred/docroot.php
All four of those 'docroot.php' scripts are the same:
<?php
echo ( $_SERVER['DOCUMENT_ROOT'] );
?>
But they're in four different directories. Document root is just
that, it's the directory where Apache (or other web servers) start
serving files from for the particular domain.
Either you're webserver is seriously hosed (I can't even imagine how),
or document root is not what you're thinking it is. If you place a
script three levels below the 'test' directory which echo's out
document root, what's the output?
Aha. So that DOES work. I see what the problem is now. I'm testing off
of a sub-domain, so the document root is the root for that sub-domain.
That's why it was tripping me up.
Thanks guys, that did the trick! :-)
--
Jeremy Privett [ http://www.jeremyprivett.com ]
Founder - Lead Software Developer - Hosting Systems Administrator
Omega Vortex
(http://www.omegavortex.com)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php