Jump to content

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


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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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