ryan.od Posted May 9, 2007 Share Posted May 9, 2007 Ok, I have a strange issue. Last night, I checked my web site. Everything worked fine. When I woke up, the main page was broken. Not sure how that could have happened. Even more strange is the error I am getting. Here it is: Warning: main(../home/maincontent.php): failed to open stream: No such file or directory in /home/tablashi/public_html/home/body.php on line 4 Warning: main(../home/maincontent.php): failed to open stream: No such file or directory in /home/tablashi/public_html/home/body.php on line 4 Warning: main(): Failed opening '../home/maincontent.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/tablashi/public_html/home/body.php on line 4 Warning: main(../home/subcontent.php): failed to open stream: No such file or directory in /home/tablashi/public_html/home/body.php on line 5 Warning: main(../home/subcontent.php): failed to open stream: No such file or directory in /home/tablashi/public_html/home/body.php on line 5 Warning: main(): Failed opening '../home/subcontent.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/tablashi/public_html/home/body.php on line 5 Warning: main(../footer/footer.php): failed to open stream: No such file or directory in /home/tablashi/public_html/home/body.php on line 6 Warning: main(../footer/footer.php): failed to open stream: No such file or directory in /home/tablashi/public_html/home/body.php on line 6 Warning: main(): Failed opening '../footer/footer.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/tablashi/public_html/home/body.php on line 6 The strange thing is the files that cannot be included are in the same directory as other files that are included in EXACTLY the same manner. Some include / some do not (i.e. home/masthead.php includes fine). Again, all of them included 12 hours ago with no problems whatsoever. What could have changed without me doing anything? How is it that some files in a directory are accessible and some are not? They all exist and all have the same permissions and there are NO typos. RyanOD Quote Link to comment https://forums.phpfreaks.com/topic/50678-cannot-get-files/ Share on other sites More sharing options...
JakeTheSnake3.0 Posted May 9, 2007 Share Posted May 9, 2007 Well apparently the file "body.php" is looking for the file "maincontent.php" 3 directories above where it resides....and since it's throwing an error, I'm assuming that ISN'T where your maincontent.php file resides. Make sure you set your include path either in your php.ini or somewhere in the beginning of your script. Let's say you have a folder called 'includes' inside your public_html/home directory....and maincontent.php resides in that directory $path = "/home/tablashi/public_html/home/includes/"; set_include_path(get_include_path() . PATH_SEPARATOR . $path); So now your include path will be php.ini's default PLUS "/home/tablashi/public_html/home/includes/"... and now when you include your maincontent.php from your body.php, all you would have to do is type... include("maincontent.php"); Quote Link to comment https://forums.phpfreaks.com/topic/50678-cannot-get-files/#findComment-249150 Share on other sites More sharing options...
ryan.od Posted May 9, 2007 Author Share Posted May 9, 2007 Fantastic!! Thank you so much. I still don't know what happened that threw the site all out of whack, but your solution trumps my original approach many times over. Thanks a lot. RyanOD Quote Link to comment https://forums.phpfreaks.com/topic/50678-cannot-get-files/#findComment-249336 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.