Re: Overriding $DOCUMENT_ROOT in an Apache Module
| From: | Rasmus Lerdorf | Date: | Thu, 25 Sep 2003 02:26:02 +0000 |
| Subject: | Re: Overriding $DOCUMENT_ROOT in an Apache Module | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-4574@lists.php.net to get a copy of this message | ||
On Wed, 24 Sep 2003, Mark Morley wrote:
> > This doesn't really have anything to do with PHP. You are writing an
> > Apache module. You simply have to change the doc_root before Apache gets
> > to the content handling phase of the request_rec. And to change the
> > doc_root I think you'd just fiddle with conf->ap_document_root and it
> > should all fall into place. But again, this has nothing to do with PHP.
> >
> > -Rasmus
>
> Thanks for the reply, but that's not it. I'm already setting the
> document root as far as Apache is concerned, at it works fine for
> everything *except* PHP. That is, PHP scripts are loaded and run
> properly, except that $DOCUMENT_ROOT does not reflect the value
> I set. So the question remains, how can I override PHP's opinion
> of what the document root is (if at all)?
Actually, that is it. PHP does not have its own version of that value.
It simply loops through Apache's subprocess_env and sets whatever is there
in the $_SERVER array. So if you set it correctly in Apache it will be
set correctly in PHP. If it isn't set in PHP, you didn't set it correctly
in Apache.
-Rasmus