Jump to content

[SOLVED] failed to open stream which attempting to include file error


webguync

Recommended Posts

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.

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

 

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

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

 

 

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.