Re: Overriding $DOCUMENT_ROOT in an Apache Module
| From: | Rasmus Lerdorf | Date: | Thu, 25 Sep 2003 01:16:26 +0000 |
| Subject: | Re: Overriding $DOCUMENT_ROOT in an Apache Module | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-4572@lists.php.net to get a copy of this message | ||
On Wed, 24 Sep 2003, Mark Morley wrote:
> I'm working on a custom mass hoting Apache module.
>
> I need to be able to set the $DOCUMENT_ROOT value on a per
> request basis. That is, I'd like to be able to set it in my module before
> the clients' scripts run (similar to how I use zend_alter_ini_entry to
> alter ini values).
>
> I've tried using Apache's ap_table_set call to define the environment
> variable, but PHP seems to clobber that and replace it.
>
> Any thoughts?
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