aniesh82 Posted September 1, 2008 Share Posted September 1, 2008 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 More sharing options...
valtido Posted September 1, 2008 Share Posted September 1, 2008 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 Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-630958 Share on other sites More sharing options...
ranjuvs Posted September 1, 2008 Share Posted September 1, 2008 Check whether the file named '1' is present in the directory. Regards Ranju Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-630960 Share on other sites More sharing options...
Fadion Posted September 1, 2008 Share Posted September 1, 2008 Your code may be: <?php require('1'); ?> Which actually makes no real sense, as i'm sure that "1" file has any extension. Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-630966 Share on other sites More sharing options...
aniesh82 Posted September 1, 2008 Author Share Posted September 1, 2008 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. Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-630975 Share on other sites More sharing options...
valtido Posted September 1, 2008 Share Posted September 1, 2008 check if ttt.php is under _members folder if not then tell us where ur ttt.php is located Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-630979 Share on other sites More sharing options...
aniesh82 Posted September 1, 2008 Author Share Posted September 1, 2008 Yes.. tttp.php is in the _members folder.. Both included and calling page is on the same directory.. Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-630986 Share on other sites More sharing options...
valtido Posted September 1, 2008 Share Posted September 1, 2008 u dont really need or die bit because you are not putting a page that someone can change it basically ttt.php and test9.php should both be under _members folder. i dont know where included came from lol but do explain Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-630995 Share on other sites More sharing options...
PFMaBiSmAd Posted September 1, 2008 Share Posted September 1, 2008 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; Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-631004 Share on other sites More sharing options...
aniesh82 Posted September 1, 2008 Author Share Posted September 1, 2008 Thank you Mr. PFMaBiSmAd It works now when I removed the die() and () .. Now it just contains include "ttt.php".. Thank you for other phpfreaks members who responded very quickly. Link to comment https://forums.phpfreaks.com/topic/122214-solved-page-include-not-working/#findComment-631053 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.