Jump to content

[SOLVED] page include not working


aniesh82

Recommended Posts

Hi,

 

I have created a page and it includes another page from the same directory.. But it doesn't executes and returns fatal error... The error returned is below:

 

Warning:  require(1) [function.require]: failed to open stream: No such file or directory in /home/.dorkis/msavery/mcat-prep.com/_members/test9.php on line 2

 

Fatal error:  require() [function.require]: Failed opening required '1' (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.dorkis/msavery/mcat-prep.com/_members/test9.php on line 2

 

 

Is it due to any setting in php.ini ?

 

 

Link to comment
https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/
Share on other sites

no it only means u have placed a file which doesnt exist

 

Warning:  require(1) [function.require]: failed to open stream: No such file or directory in /home/.dorkis/msavery/mcat-prep.com/_members/test9.php on line 2

 

it should be

 

../dorkis/........

 

not a single dot go to test9.php line two n make sure its the correct path

 

Thank you for your reply..

 

Below the page, which includes the page ttt.php

<?php

include('ttt.php') or die('Could not found');

echo "FOUND";

?>

 

 

Error Returned:

**************

 

 

Warning: include(1) [function.include]: failed to open stream: No such file or directory in /home/.dorkis/msavery/mcat-prep.com/_members/test9.php on line 1

 

Warning: include() [function.include]: Failed opening '1' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.dorkis/msavery/mcat-prep.com/_members/test9.php on line 1

FOUND

 

 

I have uploaded both the pages to same directory and when I executes the that includes the second one, it returns the following error.. I am fully confused and think that, it is because of some php.ini settings.

Simply remove the or die().

 

Because include is not really a function (the () around the file name are ignored) what you have is really - include 'ttt.php' or die('Could not found');. ''ttt.php' or anything evaluates to 1, resulting in - include 1;

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.