webguync Posted October 3, 2007 Share Posted October 3, 2007 Hello, I have file within a directory on the server, for instance index.php inside of a directory called 'About_Us', and I also have includes within a directory called 'includes'. I am trying to reference the include 'meta_tags.inc' as such: <?php require('/includes/meta_tags.inc'); ?> but I continually get a warning and fatal error. No such file or directory. I double checked and all of the necessary files are on the server and everything is being named correctly. I also tried adding ../ and /../ in front of the path and nothing has worked. I believe that this is a problem with the path to the file, but is seems like it would be the correct path. Any suggestions/help would be appreciated. Quote Link to comment Share on other sites More sharing options...
shocker-z Posted October 3, 2007 Share Posted October 3, 2007 try removing the first / <?php require('includes/meta_tags.inc'); ?> also if it's linux make sure it's all lowercase as it is case sensitive. Liam Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 3, 2007 Share Posted October 3, 2007 worst case, try this i assume at the location of the current file is below the includes folder require_once dirname(__FILE__)."/includes/meta_tags.inc"; Quote Link to comment Share on other sites More sharing options...
haaglin Posted October 3, 2007 Share Posted October 3, 2007 Are you sure the extension is .inc and not inc.php ? does this work? <?php require('/includes/meta_tags.inc.php'); ?> Quote Link to comment Share on other sites More sharing options...
webguync Posted October 3, 2007 Author Share Posted October 3, 2007 yes, I am sure the extension is .inc. I also tried taking out the initial /. I will try using require_once dirname(__FILE__)."/includes/meta_tags.inc"; I won't be able to get to it again this evening. I believe that the file with the include and the include itself would be at the same level since they are both one level into directories. eg: www.urlforwebsite/about_us/index.php www.urlforwebsite/includes/meta_tags.inc Quote Link to comment Share on other sites More sharing options...
MadTechie Posted October 3, 2007 Share Posted October 3, 2007 if their on the same level then require_once "meta_tags.inc"; or require_once dirname(__FILE__)."/meta_tags.inc"; should work Quote Link to comment Share on other sites More sharing options...
webguync Posted October 4, 2007 Author Share Posted October 4, 2007 grrrrr, I am still getting errors. Warning: main(/home/warriors/public_html/About_Us/includes/meta_tags.inc) [function.main]: failed to open stream: No such file or directory in /home/warriors/public_html/About_Us/index.php on line 6 Fatal error: main() [function.require]: Failed opening required '/home/warriors/public_html/About_Us/includes/meta_tags.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/warriors/public_html/About_Us/index.php on line 6 I used <?php require_once dirname(__FILE__)."includes/meta_tags.inc";?> and also tried with a / in front of includes Quote Link to comment Share on other sites More sharing options...
teng84 Posted October 4, 2007 Share Posted October 4, 2007 can you post how you store your file eg.. folder/folder/your_page.php and the folder/etc.. / yourpage to beinculded.inc Quote Link to comment Share on other sites More sharing options...
webguync Posted October 4, 2007 Author Share Posted October 4, 2007 sure the page file would be in About_Us/index.php and the include file would be in includes/meta_tags.inc both sit inside of a directory www actual paths to the files in question are: http://www.warriorsarise.org/About_Us/index.php and http://www.warriorsarise.org/includes/meta_tags.inc I have taken the includes out temporarily so an error is not currently thrown Quote Link to comment Share on other sites More sharing options...
teng84 Posted October 4, 2007 Share Posted October 4, 2007 require('../includes/meta_tags.inc'); or require('./includes/meta_tags.inc'); Quote Link to comment Share on other sites More sharing options...
webguync Posted October 4, 2007 Author Share Posted October 4, 2007 that resolved it thanks. I have another issue, but I will repost under another topic. Quote Link to comment Share on other sites More sharing options...
teng84 Posted October 4, 2007 Share Posted October 4, 2007 Quote Link to comment 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.