Re: On more time with PATHS!

From: Date: Tue, 22 Apr 2003 03:10:48 +0000
Subject: Re: On more time with PATHS!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144757@lists.php.net to get a copy of this message
You're right, it shouldn't be this hard - but I have been doing exactly what has been suggested in this list and the problems still exists. This is why I am just a little bit pissed here. I have given files the exact path - and I still get errors that they don't exist - and please, don't tell me I am doing something wrong - if I give the exact path to a file and PHP can't find it, then there is something wrong - and this has been on-going since I started this project. I guess at this point I'll have to muddle through it as it's too late to do something else, but I may have to rethink things for future projects. C.R. ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "'C.R.'" <odcs@rogers.com>; "'Kevin Stone'" <kevin@helpelf.com>; "'PHP General'" <php-general@lists.php.net> Sent: Monday, April 21, 2003 10:21 PM Subject: RE: [PHP] On more time with PATHS! > Look, just use absolute paths for everything, from the server root, not > the web root. > > If you have a file with a path (from the server root) as: > > /home/usr/www/includes/functions.inc > > Then if you use > > Include('/home/usr/www/includes/functions.inc') from any file, from any > directory, no matter how many nested includes there are, it'll work. > > This really shouldn't be this hard... > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > > -----Original Message----- > > From: C.R. [mailto:odcs@rogers.com] > > Sent: Monday, April 21, 2003 6:51 PM > > To: Kevin Stone; PHP General > > Subject: Re: [PHP] On more time with PATHS! > > > > I understand what you are saying, but what if a particular file needs > to > > be > > included from a number of files that are in other included files - > then > > the > > path is screwed up - or if the included file has other included files, > > which > > then includes the included file itself - I'm not sure if your > following > > what > > I am saying here - but you can see the chain of includes gets so deep > - > > how > > is it possible to keep it straight. In these cases your suggestion > won't > > work - ../file.php may be correct for file 'a', but if this is > included > > from > > file 'c' and 'e', then ../file.php is no longer correct. it may be > > ../../file.php or maybe just /file.php. depending on where the > original > > script was run from..... > > > > I don't know - but right now I am spending 90% of my time trying to > figure > > this out and 10% on the script itself. > > > > > > ----- Original Message ----- > > From: "Kevin Stone" <kevin@helpelf.com> > > To: "C.R." <odcs@rogers.com>; "PHP General" > <php-general@lists.php.net> > > Sent: Monday, April 21, 2003 2:43 PM > > Subject: Re: [PHP] On more time with PATHS! > > > > > > > ----- Original Message ----- > > > From: "C.R." <odcs@rogers.com> > > > To: "PHP General" <php-general@lists.php.net> > > > Sent: Monday, April 21, 2003 12:08 PM > > > Subject: [PHP] On more time with PATHS! > > > > > > > > > > You guys are probably getting tired of reading my emails, but this > > > > path/include problem is just never ending. I don't even know how > to > > > explain > > > > the problem because I don't understand it. I am simply trying to > > include > > > > files that are in the same directory or directory structure, but > no > > matter > > > > what I do I get the same damn message that this or that file can't > be > > > > found - I have tried giving it the exact path, the exact url, and > > anything > > > > else I can think of - but somewhere along the line - some file > won't > > be > > > > found. > > > > > > > > I think the problem is this, but I have no idea how to solve it. > If I > > > > include a file which also includes other files - then the path > > structure > > > > somehow gets screwed up. How do I keep them straight through > multiple > > > > includes and directories. I don't know if I am making any sense - > but > > this > > > > is my last ditch effrot on this before I move on to some other way > of > > > doing > > > > this - whether it be java, asp, or whatever. > > > > > > > > Everyone in here has been great, but I am to the point now where I > am > > just > > > > fed up with PHP because of this bloody issue. > > > > > > > > Thanks > > > > > > > > C.R. > > > > > > Use the absolute path beginning from the account's root directory. > echo > > > $_SERVER['DOCUMENT_ROOT']; So if you need to go back one directory > and > > then > > > into a folder called "functions" you'd simply do.. > > > > > > <? // include test > > > $root = $_SERVER['DOCUMENT_ROOT']."/"; > > > include($root."../functions/myfunctions.php"); > > > ?> > > > > > > Got it? Good luck. :) > > > > > > - Kevin > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#144757) next »