Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/50678-cannot-get-files/
Share on other sites

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");

Link to comment
https://forums.phpfreaks.com/topic/50678-cannot-get-files/#findComment-249150
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.