php $DOCUMENT_ROOT in include
Nick Barker
pluglist at plug.org
Wed Apr 23 13:15:08 MDT 2003
check the php.ini . Magic quotes being off and globals being off will
affect this.
----- Original Message -----
From: "Wade Preston Shearer" <groups at anavidesign.com>
To: "PLUG POST" <pluglist at plug.org>
Sent: Wednesday, April 23, 2003 12:56 PM
Subject: php $DOCUMENT_ROOT in include
> a php question.
>
> a few months back, someone showed me how to use "$DOCUMENT_ROOT within
> an include, like...
>
> <?php @readfile($DOCUMENT_ROOT."/includes/file.inc"; ?>
>
> ...or...
>
> <?php include("$DOCUMENT_ROOT/includes/file.inc"; ?>
>
>
> this has been working great.
>
> i just upgraded one of my servers to apache 2 however and it stopped
> working. i have debugged to the point where in know that it is the
> "$DOCUMENT_ROOT" part that isn't working.
>
> i checked "httpd.conf" and "php.ini" and everything is in order
> (including "allow_url_fopen").
>
> then, curiously, i added...
>
> <?php $DOCUMENT_ROOT = "/path/to/doc/root"; ?>
>
> ...before the includes... and WHA-LA! they work.
>
> so... i gather then, that the part that isn't working is that is isn't
> finding document root and that is why the includes are not working.
>
> before i go further... let me ask a question...
>
> i assumed that $DOCUMENT_ROOT was a "set" variable. by "set," i mean on
> that is set by the "PHP guys," like $PHP_SELF. i thought that it was
> built-in and that's how it got it's value. but, from the test that
> tried, defining a value for the $DOCUMENT_ROOT variable, it makes me
> wonder...
>
> is the variable defined by the PHP module (part of the
> package/brains/guts/whatever)?
>
> or is it defined by the user... as part of either a conf/ini file or
> even in a page/script?
>
> so... my final question then... if the variable _is_ set by the user...
> where?
>
> -wade preston shearer
>
>
> .===================================.
> | This has been a P.L.U.G. mailing. |
> | Don't Fear the Penguin. |
> `==================================='
>
More information about the PLUG
mailing list