> -----Original Message----- > From: Giles Roadnight [mailto:giles@xxxxxxxxxxxxxx] > Sent: 09 November 2004 13:07 > To: php-general@xxxxxxxxxxxxx > Subject: help with fopen path > > > Hi All > > I'm developing a fusebox PHP app and have a class in a /classes > directory that opens an xml file in a directory below the site root > using this path: "../siteconfig.xml" > > All of the places I have used this class from so far have been in the > site root. I am now starting some pages in a sub directory. When I use > this class it says it can't open the file. I have tried > "../../siteconfig.xml" instead but it doesn't work either. > > What's the best way to go about fixing this? I'm quite new to php and > I'm not sure where the relative path is taken from - i.e. is it the > index.php page or the class (obviously not) or my switch file or what? > Just a thought: If your referencing a file within a PHP script that is included/required within another script the path should be relative to the 'parent' script. I am guessing that if you make reference above the site root (using ../../) the site root will be assumed. If you have access to the web server config try setting up an alias such as /config which points to the directory containing your config xml so that your scripts can reference "/config/siteconfig.xml" from any directory. HTH Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php