PHP include within an included file and relative paths
<p>This bug has depleted my rational thinking power over the past 64 minutes and I really don't know what I should do.</p>

<p>When i use the following 3 lines in an included file:</p>

<pre><code>var_dump(file_exists('G:/xampp/htdocs/myproject/public_html/includes/htmlPurifierAndMarkdown.php')); //retuurns true
var_dump(__FILE__);
include '../htmlPurifierAndMarkdown.php'; //gives error
</code></pre>

<p>i get the following output :</p>

<pre><code>boolean true

string 'G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php' (length=71)


( ! ) Warning: include(../htmlPurifierAndMarkdown.php) [function.include]: failed to open stream: No such file or directory in G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php on line 4
Call Stack
#   Time    Memory  Function    Location
1   0.0005  345328  {main}( )   ..\add.php:0
2   0.0036  382408  include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\events.class.php' )    ..\add.php:28
3   0.0041  398024  include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\standardpost.class.php' )  ..\events.class.php:2
4   0.0047  413928  include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php' )    ..\standardpost.class.php:2
</code></pre>

<p>In a nutshell:</p>

<ol>
<li>The first line tells that the file is not a part of my imagination and it actually exists.</li>
<li>The second line tells the location of my calling script, on examining the paths closely, you'll notice that the file I'm trying to include resides in the parent directory</li>
<li>Include function says that file dosent exist </li>
</ol>

<p>so am i just imagining stuff or is this some serious php bug?</p>

<h2>Update</h2>

<p>when i access <code>genral.class.php</code> manually, no error is generated. do special rules apply when including from within an included file?</p>

<p><strong>Update 2</strong></p>

<p>When i set the include path to '../includes/htmlPurifierAndMarkdown.php' , which is the path relative to the main calling script, which in turn includes a script which includes <code>genral.class.php</code> it works, but since this new include is relative to only one of the many calling scripts, it breaks down for the others. Do special rules apply when including a file from within an included file??</p>
