AppleTattooGuy AppleTattooGuy - 4 years ago 138
PHP Question

Failed opening '../tweets.php' for inclusion (include_path='.:')

I am trying to include a script using the following code.

<div class="main_content">
<?php include ('tweets.php') ?>

But it keeps throwing up the following error.

Warning: include(tweets.php): failed to open stream: No such file or
directory in - on line 52 Warning: include(): Failed opening
'tweets.php' for inclusion (include_path='.:') in - on line 52

I have checked and double checked and the file definitely exists and is in the same directory as the file that this is in.

I really appreciate your help on this.

Answer Source

The path is relative to the file where the request was initiated. So, even if it's in the same folder as the file it's including, if that file was included from a file in a different folder, you will have to use an absolute path or a path relative to the original file.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download