note 15715 deleted from function.include by sniper
| From: | sniper@php.net | Date: | Wed, 29 Jan 2003 04:06:55 +0000 |
| Subject: | note 15715 deleted from function.include by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42977@lists.php.net to get a copy of this message | ||
I just ran into an interesting issue. I was trying to include a file from one directory higher,
using a variable that evaluated to "../startpage.php". It worked fine on a target server
using IIS/PHP 4, but not on my development Apache/PHP server.
It turns out that on my development server, the subdirectory was actually a symlink to elsewhere.
So what I had was a base directory for the project of /var/www/html/base/ which had an include file
of startpage.php. I was automatically generating pages elsewhere on my system using Doxygen, and so
I created a symlink "doxy" pointing to the output directory. The templates in the Doxygen
output checked $PHP_SELF to determine if the file was loaded directly, or included from the base
directory, and if it was directly, it included "../startpage.php". But when I viewed the
file, PHP gave me an error, saying it couldn't find the page!
Turns out include("../startpage.php") tried to find the file in the parent directory of
the Doxygen output, rather than following the symlink back to /var/www/html/base!
Solution: Move the Doxygen target directory to /var/www/html/base/doxy, and symlink from the other
location.
Hope this helps someone!
Cheers,
John