note 15715 added to function.include

From: Date: Thu, 27 Sep 2001 16:51:32 +0000
Subject: note 15715 added to function.include
Groups: php.notes 
Request: Send a blank email to php-notes+get-18373@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 -- http://www.php.net/manual/en/function.include.php http://master.php.net/manage/user-notes.php?action=edit+15715 http://master.php.net/manage/user-notes.php?action=delete+15715 http://master.php.net/manage/user-notes.php?action=reject+15715

« previous php.notes (#18373) next »