phporcaffeine Posted January 3, 2007 Share Posted January 3, 2007 ***SYS SPECS***Apache 2.2.3PHP 5.2Win XP ProHas Access to PHP.INIHas Access to httpd.conf*******************here is a sample folder tree that I have/root|> folder_1 |> file_1.php|> file_2.phpI want to 'require()' file_2.php FROM file_1.php. Why can't I use [code]require('../file_2.php');[/code] in file_1.php?If it can be done that way, could someone show me how? I have been playing with include_path in the .INI all day and I have yet to figure it out.If you have a better solution, I'm up for that as well. My basic objective is to be able recursivly 'require' / 'include' files without having to enter the full file/url path.TIA Quote Link to comment https://forums.phpfreaks.com/topic/32733-file-path-question/ Share on other sites More sharing options...
Jessica Posted January 3, 2007 Share Posted January 3, 2007 Why can't you? What error do you get? Quote Link to comment https://forums.phpfreaks.com/topic/32733-file-path-question/#findComment-152363 Share on other sites More sharing options...
phporcaffeine Posted January 3, 2007 Author Share Posted January 3, 2007 here is the error:Warning: require(../ktrack_inclusion.php) [function.require]: failed to open stream: No such file or directory in F:\Apache2\htdocs\modules\ktrack\library\inc\headers\header.global.php on line 5The file 'ktrack_inclusion.php' exists in: F:\Apache2\htdocs\modules\ktrack\library\inc Quote Link to comment https://forums.phpfreaks.com/topic/32733-file-path-question/#findComment-152366 Share on other sites More sharing options...
taith Posted January 3, 2007 Share Posted January 3, 2007 i know i've done this before... and the error looks the same[code]require('../ktrack_inclusion.php'); #you must have the '[/code]and if it is just an included file, you prolly wanna require_once(); ;-) Quote Link to comment https://forums.phpfreaks.com/topic/32733-file-path-question/#findComment-152371 Share on other sites More sharing options...
phporcaffeine Posted January 3, 2007 Author Share Posted January 3, 2007 I am using quotes, PHP doesn't echo quotes when it renders errors in the header (to the browser) Quote Link to comment https://forums.phpfreaks.com/topic/32733-file-path-question/#findComment-152374 Share on other sites More sharing options...
phporcaffeine Posted January 3, 2007 Author Share Posted January 3, 2007 I got it fixed, thanks Quote Link to comment https://forums.phpfreaks.com/topic/32733-file-path-question/#findComment-152380 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.