RE: [PHP] On more time with PATHS!

From: Date: Mon, 21 Apr 2003 18:39:52 +0000
Subject: RE: [PHP] On more time with PATHS!
Groups: php.general 
Request: Send a blank email to php-general+get-144688@lists.php.net to get a copy of this message
> -----Original Message----- > From: C.R. [mailto:odcs@rogers.com] > Sent: Monday, April 21, 2003 2:08 PM > To: PHP General > Subject: [PHP] On more time with PATHS! > > 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. > Maybe you're getting confused between the web servers path which is doc rooted, and php, which is system rooted. So in php you can read /www/htdocs/sites/www.mysite.com/ where as to the web server that location is simply / Also, every file included is relative to the main script being executed. Say you have: index.php inc/include1.php inc/include2.php subdir/myfile.php If index.php includes inc/include1.php you would: require 'inc/include1.php'; If you are executing the script http://www.somesite.com/subdir/myfile.php, and that file needs include1.php, you could either do a require '../inc/include1.php'; or config php to search the inc directory and just: require 'include1.php

« previous php.general (#144688) next »