Re: Using function in PHP script n DOCROOT in PHP script in subfolder
| From: | Phil Powell | Date: | Sat, 11 May 2002 21:53:10 +0000 |
| Subject: | Re: Using function in PHP script n DOCROOT in PHP script in subfolder | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97172@lists.php.net to get a copy of this message | ||
Found a MUCH MUCH simpler solution that works across the board.. change
$HTTP_HOST to $DOCUMENT_ROOT and it works!
Phil
"Analysis & Solutions" <danielc@analysisandsolutions.com> wrote in message
news:20020511020508.GA14089@panix.com...
> Phil:
>
> On Fri, May 10, 2002 at 08:01:46PM -0400, Phil Powell wrote:
> >
> > How do I fix this problem? I do not want to duplicate the PHP script per
> > folder as there will be an enormous amount of dynamically-created
subfolders
> > and I will have to copy a version per folder. I want to be able to use
the
> > one PHP script in the DOCROOT for every PHP script in every subfolder,
how
> > is this done?
>
> Have a file in each directory called, for the sake of example,
> "directory.inc" In that file, set a variable called, "$root" The
> value of it should be the relative path used to find the root
> directory, eg "../../". This will vary depending on the directory
> depth. Each script on your site then should have
> "require('./directory.inc');" at the top. Now, you'll always know
> where to find the root. This also makes things easy to move from one
> server to another in the future.
>
> Another way to do this is to use the auto_prepend_file setting to
> include your file that has the function in it.
>
> http://www.php.net/manual/en/configuration.php#ini.auto-prepend-file
>
> Enjoy,
>
> --Dan
>
> --
> PHP classes that make web design easier
> SQL Solution | Layout Solution | Form Solution
> sqlsolution.info | layoutsolution.info | formsolution.info
> T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
> 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409