Reply to Re: Dumbfounded

Your name:

Reply:


Posted by Justin Koivisto on 02/23/06 16:30

d wrote:
> "Justin Koivisto" <justin@koivi.com> wrote in message
> news:43fd2f26$0$15443$6d36acad@titian.nntpserver.com...
>> ZeldorBlat wrote:
>>> Justin Koivisto wrote:
>>>> Sheldon Glickler wrote:
>>>>> require_once("sqlLoginDB.php");
>>>> If this is going into a function or included file, it should be an
>>>> absolute path. For instance, if the sqlLoginDB.php file is lcoated in
>>>> the same directory where this code is found, you should use:
>>>>
>>>> require_once dirname(__FILE__).'/sqlLoginDB.php';
>>>>
>>>> That way, no matter what the current working directory is, the file can
>>>> be found.
>>> Absolutely not. This would imply that sqlLoginDB.php lives in the same
>>> (internet-accessible) directory as the calling file. Files that you
>>> include (database connection code, class definitions, etc.) should live
>>> in a directory /outside/ the webserver document tree. Set the include
>>> path directive in php.ini appropriately.
>> I think you missed the point of my statemnet. I didn't say do save it
>> there... I said *if* it was saved there... The point I was making is that
>> you want to use absolute system paths, not relative.
>
> There are perfectly good reasons for using relative paths as opposed to
> absolute... :)

The way I usually handle it is to set the include_path and then use
relative paths. However, when I am not doing that, I like to use things
like:

dirname(__FILE__).'/../../../inc_dir/file.php';

that way it is an absolute path according to the execution, but still
relative in relation to the script. (If that makes any sense!)

--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация