Maybe not the most elegant, but I like to keep my stuff kind of modular so what I've done is just create an "includes" folder in the root and them reference it as include("../includes/includename.inc") from the scripts that are all in their own folders (by project). This may not be the best as far as security is concerned since it's easy to guess at "/includes" existence and some include files might contain information that could be useful to a would-be hacker, but I'm working on an internal environment anyway so it's not so critical for me. I have a handful of includes that are universal that I keep in there. If something is project specific, I put it in that project's folder (or an includes folder under the project folder). I have all of my database connect strings in one file, I also have a usage logging include as well as a date conversation include with a bunch of functions that convert from one date format to another since I use that a lot. Ideally you'd set your include_path and put your scripts in one of those folders presumably so that the sometimes-sensitive include files are accessible to PHP but not necessarily to the webserver to send out to someone trying to steal your stuff. But if you can't change the php.ini, maybe do something like I do. Although, thinking about it, if you have access to a folder above where your website lives, you could do something like this: $dir = dirname($_SERVER["PATH_TRANSLATED"]) . "/../includes/"; include($dir ."includefile.inc"); That'd give you the "c:\foldername\" full path of the currently executing script, then go up a level (parent folder) then back down to an includes folder. Add more ".." to go further. As long as permissions are proper for accessing that folder, that'd probably work. Play around with it! There are a number of path oriented commands and global variables that may help you even if you don't have access to PHP.ini Just some thoughts and feedback. -TG > -----Original Message----- > From: neil [mailto:neil@xxxxxxxxxxx] > Sent: Tuesday, August 17, 2004 8:31 AM > To: php-windows@xxxxxxxxxxxxx > Subject: Re: include_path and relative vs. absolute paths > > > Thanks John > > That is a great solution, well at least for my development > box where I can > control my php.ini. The jokers who host one of the sites I > look after have > the include_path pointing to a non-existent place and won't modify it. > > Thanks anyway > Neil > > "John Lim" <jlim@xxxxxxxxxxxxxx> wrote in message > news:20040817104641.64977.qmail@xxxxxxxxxxxxxxx > > Good question. I had the same problem when i switched from > .asp to .php > > > > Suppose you want to use relative paths, eg. reference > child1.php from > > file1.php, where the file locations are: > > > > path/file1.php > > path/child/child1.php > > > > The trick is to generate an absolute path for the current > file, and find > all > > relative files based on this absolute path. > > > > eg. in file1.php: > > > > $file1AbsPath = dirname(__FILE__); > > include($file1AbsPath ."/child/child1.php"); > > > > > > > > "Neil" <neil@xxxxxxxxxxx> wrote in message > > news:20040817010732.57277.qmail@xxxxxxxxxxxxxxx > > > I am still getting used to .php after moving from .asp > and one thing I > had > > > trouble getting my head around was the apparent inability to use > absolute > > > paths for include files. > > > > > > If I change the include_path in php.ini to say - > > > include_path=".;c:\php\site1\inc" then I can access > include files either > > > relatively > > > eg. require '../includes/somefile.php'; where the > includes folder is at > > the > > > same level as the current folder > > > or absolutely > > > eg. require 'somefile.php'; where the file is either in > the same folder > or > > > is c:\php\site1\inc > > > > > > Now the second option is fine except if I have multiple > sites on the one > > > server. > > > > > > With .asp it would just read /inc/somefile.inc either > from the root of > the > > > site or from a virtual folder but the include_path > setting forces all > the > > > sites to use the either the one include folder or at > least not use the > > same > > > file names if there are multiple folders specified. > > > > > > Does anyone know another way of dealing with this? > > > > > > Thanks > > > > > > Neil > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php