RE: [PHP] Includes and paths problem

From: Date: Sat, 19 Apr 2003 02:18:31 +0000
Subject: RE: [PHP] Includes and paths problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144460@lists.php.net to get a copy of this message
Are you absolutely sure that $_CONF['path'] is set at the place you're calling it? It doesn't look like it. PHP is looking for /messages.inc, which would be in the root of the C: drive, instead of having the whole path. Right before line 36 or 42, try to echo out the value of $_CONF['path']... Echo "Value is: {$_CONF['path']}"; Include(...); ---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: Friday, April 18, 2003 10:04 PM > To: holmes072000@charter.net; 'PHP General' > Subject: Re: [PHP] Includes and paths problem > > It doesn't work. This is what I have been fighting with for months with > various scripts I've been working on. I basically already had what you > suggested, and I just changed it to exactly what you suggested - and the > same bloody thing happens. Error after error after error. > > This is my path "d:/websites/project/login" > > This is how I assigned it - <? $_CONF['path'] = > 'd:/websites/project/login'; ?> > > This is how I include files - include($_CONF['path'] . '/whatever.php'); > > This is what I get - > > Warning: main(/messages.inc) [function.main]: failed to create stream: No > such file or directory in d:\websites\project\login\login.php on line 36 > Warning: main() [function.main]: Failed opening '/messages.inc' for > inclusion (include_path='.;D:\PHP\includes') in > d:\websites\project\login\login.php on line 36 > > Warning: main(/checklogin.php) [function.main]: failed to create stream: > No > such file or directory in d:\websites\project\login\login.php on line 42 > > Warning: main() [function.main]: Failed opening '/checklogin.php' for > inclusion (include_path='.;D:\PHP\includes') in > d:\websites\project\login\login.php on line 42 > > this is line 36 - include($_CONF['path'] . '/messages.inc'); > this is line 42 - include($_CONF['path'] . '/checklogin.php'); > > messages.inc and checklogin.inc do exist in 'd:/websites/project/login'. > > So what am I doing wrong? > > Thanks > > ----- Original Message ----- > From: "John W. Holmes" <holmes072000@charter.net> > To: "'C.R.'" <odcs@rogers.com>; "'PHP General'" > <php- > general@lists.php.net> > Sent: Friday, April 18, 2003 8:17 PM > Subject: RE: [PHP] Includes and paths problem > > > > > When you say "absolute" is this absolute to your root directory of > > your > > > website or your computer. Sorry if this sounds stupid, but I have been > > > struggling with this for some time and want to be sure I'm doing this > > > right. > > > So in your example ($_CONF['path'] = '/home/web/www/site';) - > > > what is > > this > > > in relation to? Oh, by the way - this is Windows 2000 server using IIS > > > (not > > > my idea). > > > > To your computer. So, for windows, you could have something like this: > > > > $_CONF['path'] = 'C:/inetpub/wwwroot/site'; > > > > for example. Then you just use that to build your includes. If you want > > to include the file 'include.php' that's in the root of your web site, > > then you can use > > > > include($_CONF['path'] . '/include.php'); > > > > from any file on your site, no matter what directory or subdirectory > > it's in. > > > > ---John W. Holmes... > > > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > > today. http://www.phparch.com/ > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

« previous php.general (#144460) next »