Re: Re: Include problems
| From: | Shawn McKenzie | Date: | Sun, 04 May 2003 14:25:53 +0000 |
| Subject: | Re: Re: Include problems | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-146350@lists.php.net to get a copy of this message | ||
Thanks Ernest,
[snip]
You always need to include a script either absolute from the hosts
> root directory (e.g. '/var/www/tools/scripts/helper.inc')
Thus you can use symbolic path names for inclusion, and don't
> have too much hassle when redesigning your directory layout.
[/snip]
I thought that was what I was doing. __FILE__ is supposed to return the
current file and dirname() is supposed to return the path to that file. It
seems that the now 2 people running into issues with this are both running
SunOS 5.7. Many others run this script with no problem on Windows, Linux,
BSD, OSX, etc.
Thanks!
Shawn
"Ernest E Vogelsinger" <ernest@vogelsinger.at> wrote in message
news:5.1.1.6.2.20030504112000.04487ad0@mail.vogelsinger.at...
> At 21:09 03.05.2003, Shawn McKenzie said:
> --------------------[snip]--------------------
> >I understand what's being said that . is the current dir, but shouldn't
PHP
> >look in the dir returned by dirname(__FILE__) before it looks in the
include
> >path???
> --------------------[snip]--------------------
>
> As long as a script doesn't chdir() to another directory you're located in
> the directory where the initial script os located (usually the webserver's
> DOCROOT, plus any additional tree branch from the URL.
>
> Assuming DOCROOT is /var/www:
> http://dom/script.php /var/www/script.php
> http://dom/sub/script.php /var/www/sub/script.php
>
> This doesn't change for included scripts, regardless where they are
> located. You always need to include a script either absolute from the
hosts
> root directory (e.g. '/var/www/tools/scripts/helper.inc'), or relative
from
> your starting point.
>
> For a more complex layout it might be a good idea to have a config file
> defining the locations and being included at the very top of any
> application. Thus you can use symbolic path names for inclusion, and don't
> have too much hassle when redesigning your directory layout.
>
>
> --
> >O Ernest E. Vogelsinger
> (\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>