#22865 [Opn->Bgs]: including files from higher brother dirs
| From: | mgf@php.net | Date: | Tue, 25 Mar 2003 11:14:21 +0000 |
| Subject: | #22865 [Opn->Bgs]: including files from higher brother dirs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-36378@lists.php.net to get a copy of this message | ||
ID: 22865
Updated by: mgf@php.net
Reported By: josmith at albertc dot on dot ca
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: WinNT 5 and Linux
PHP Version: 4.3.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Relative paths in include/require are always relative to the initial
script, *not* to the file doing the include-ing. Thus:
- when file1 is called directly, the relative path for include-ing
file2 is indeed ../folder2/file2
- when the original call is to index.php, which includes file1, which
includes file2, the relative path to file 2 is ./folder2/file2
(relative to index.php, *not* file1), even from within file1.
You will need to use some kind of tracking of the base path for the
current invocation.
Previous Comments:
------------------------------------------------------------------------
[2003-03-24 22:28:59] josmith at albertc dot on dot ca
ok...
index.php
folder1
file1
folder2
file2
That is the dir structure.
file1 'include()'s file2 and file1 is included in index. When file1 is
called directly from the browser it includes file2 (by using include
"../folder2/file2"). However, when file1 is included in index.php the
path to file to (located in file1) must be absolute, it cannot be
relative (although when fil1 is called directly the path to file2 can
be relative). Using any relative path does nto appear to work in this
rare case.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22865&edit=1