Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4572 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60978 invoked by uid 1010); 25 Sep 2003 01:16:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60924 invoked from network); 25 Sep 2003 01:16:49 -0000 Received: from unknown (HELO www.lerdorf.com) (66.93.78.119) by pb1.pair.com with SMTP; 25 Sep 2003 01:16:49 -0000 Received: from dhcp64-134-103-33.tis.bos.wayport.net (dhcp64-134-103-33.tis.bos.wayport.net [64.134.103.33]) by www.lerdorf.com (8.12.10/8.12.10/Debian-4) with ESMTP id h8P1GWZm025292; Wed, 24 Sep 2003 18:16:32 -0700 Date: Wed, 24 Sep 2003 18:16:26 -0700 (PDT) To: Mark Morley cc: internals@lists.php.net In-Reply-To: <011d6cb5bf19895465f9131efdc8da46@grapevine.islandnet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Overriding $DOCUMENT_ROOT in an Apache Module From: rasmus@lerdorf.com (Rasmus Lerdorf) References: <011d6cb5bf19895465f9131efdc8da46@grapevine.islandnet.com> 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