RE: [PHP] Setting include path to same directory as .php file.?
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Thu, 23 Nov 2000 02:49:43 +0000 |
| Subject: | RE: [PHP] Setting include path to same directory as .php file.? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26783@lists.php.net to get a copy of this message | ||
You may want to use a fixed (absolute) path from your web root, instead of a
relative path
eg
/phpstuff
x.php
include $DOCUMENT_ROOT . "phpstuff/x.php";
or
/pictures/phppostcard
y.php
include $DOCUMENT_ROOT . "pictures/phppostcard/y.php";
instead of
include "../phpstuff/x.php";
or
include "./pictures/phppostcard/y.php";
(dependant on your current directory)
$DOCUMENT_ROOT is your absolute path to the web root.
So if your web root is
/home/usr/mysite/
$DOCUMENT_ROOT will be equal to that.
You can then use that as a base to include your files from.
Cheers,
Lawrence.
-----Original Message-----
From: Dan Lowe [mailto:dan@tangledhelix.com]
Sent: November 23, 2000 10:37 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Setting include path to same directory as .php file.?
Can this be done from inside an individual script? I have an application
which needs to include files from a particular directory but it is
frequently not an option for my users to munge around in php.ini.
The problem is that my app is trying to co-exist with php-Nuke. I have to
include two files, which then go ahead to include further files. I can
simply include "../header.php" for example, but then it tries to include
one or more other files and then it fails because they aren't in '.' with
my script. So I have to move my script to the same as the other include
files, but that is not too popular with some users, so I'm trying to find a
way to do it "right" and have everything relating to my script exist in a
subdirectory, not tainting the "main" directory in which phpNuke resides.
TIA,
-dan
Previously, James Atkinson said:
> Just set it to
> include_path = "./:/my/path:/my_path/here";
>
> etc etc.
> That'll work for Unix but I don't know about NT as I never use NT..
--
Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/
A witty saying proves nothing. -Voltaire
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net