|  | 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
  Navigation: [Reply to this message] |