darksniperx Posted November 11, 2007 Share Posted November 11, 2007 code:inside Feed.php $language = 'en'; include_once '../lang/Feed_' .$language. '.php'; error: Warning: showfeed(../lang/Feed_en.php) [function.showfeed]: failed to open stream: No such file or directory in /home/frdowd3/public_html/alex/alpha/forms/Feed.php on line 5 Warning: showfeed() [function.include]: Failed opening '../lang/Feed_en.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/frdowd3/public_html/alex/alpha/forms/Feed.php on line 5 directory structure: alpha\ -forms\ -Feed.php -lang\ -Feed_en.php what can I do to fix the error, and I have checked all files are where they are suppose to be. Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/ Share on other sites More sharing options...
darksniperx Posted November 11, 2007 Author Share Posted November 11, 2007 I head that php include and relative path are a pain, and that it sees "../" as "/", is there anyway to fix that. I am using php 4.x Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389312 Share on other sites More sharing options...
jordanwb Posted November 12, 2007 Share Posted November 12, 2007 A couple of things: When a file (say dir1/foo.php) is included into another file (say dir2/foo.php), the source must be relative too the foo.php in dir2. Second perhaps the server does not have permission to execute the file? And possibly third does the file exist? Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389554 Share on other sites More sharing options...
Crew-Portal Posted November 12, 2007 Share Posted November 12, 2007 Very Simple because include(); is a function it needs to be inside brackets: Change <?php $language = 'en'; include_once '../lang/Feed_' .$language. '.php'; ?> To... <?php $language = 'en'; include_once ('../lang/Feed_' .$language. '.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389585 Share on other sites More sharing options...
jordanwb Posted November 12, 2007 Share Posted November 12, 2007 No you don't need to, it's a language construct (whatever that means), so it doesn't need the brackets. Same for print and echo, as well as require Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389815 Share on other sites More sharing options...
nuxy Posted November 12, 2007 Share Posted November 12, 2007 The brackets are not required, I have tested this myself before. Now, back to the question at hand. darksniperx, Try using the absolute path of that file. Example: $language = 'en'; include_once getcwd() . '/lang/Feed_' .$language. '.php'; Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389822 Share on other sites More sharing options...
centerwork Posted November 12, 2007 Share Posted November 12, 2007 Try this: $_SERVER["DOCUMENT_ROOT"] . "/lang/Feed_en.php" Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389901 Share on other sites More sharing options...
nuxy Posted November 12, 2007 Share Posted November 12, 2007 Try this: $_SERVER["DOCUMENT_ROOT"] . "/lang/Feed_en.php" That will not work if the file is in a sub directory. My example of using getcwd retrieves the current directory the script is executing from. Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389958 Share on other sites More sharing options...
darksniperx Posted November 12, 2007 Author Share Posted November 12, 2007 my ftp is down, I will try as soon as it comes back up. Thx for all your support. Thats why phpfreaks.com rocks!!!! Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-389977 Share on other sites More sharing options...
darksniperx Posted November 13, 2007 Author Share Posted November 13, 2007 Try this: $_SERVER["DOCUMENT_ROOT"] . "/lang/Feed_en.php" could not use since i am not at www root. $language = 'en'; include_once getcwd() . '/lang/Feed_' .$language. '.php'; Works Great thx.. Quote Link to comment https://forums.phpfreaks.com/topic/76886-solved-gives-problems/#findComment-390829 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.