title: Path Include error (failed to open stream - PHP)
body: <p>I'm working on a back office from scratch, and here are some folder examples</p>
  
  <p>Admin > include > global_variable.php</p>
  
  <p>Admin > sliders > variable.php</p>
  
  <p>Admin > sliders > uploadfunction > index.php</p>
  
  <p>In the index.php I have </p>
  
  <pre><code>&lt;?php include('../variable.php'); ?&gt;
  </code></pre>
  
  <p>And in the variable.php I have </p>
  
  <pre><code>&lt;?php include('../include/global_variable.php');?&gt;
  </code></pre>
  
  <p>However index.php is not reading the global_variable.php</p>
  
  <p>It gives me the below error</p>
  
  <pre><code>"Warning: include(../include/global_variable.php): failed to open stream: No such file or directory in [irrelevant]\Admin\sliders\variable.php on line &lt;i&gt;1&lt;/i&gt;"
  </code></pre>
  
  <p>No, this isn't an issue with forward-slash and back-slash, because it was working on a different architecture (I was linking ../variable.php and ../../include/global_variable.php on my index.php)</p>
  
  <p>Logically this should work, however it's not.
  My assumption is that it is reading "../include/global_variable.php" from the directory of the index.php (which it should be reading from the variable.php)</p>
  
  <p>Is there any workaround to it while keeping the same file structures?</p>
  
  <p>Thank you</p>