title: include_once, relative path in php
body: <p>I have 3 files: home, failed_attempt, login.</p>
  
  <p>The file home and failed_attempt all refer to login file.</p>
  
  <p>The annoying thing is that they throw a mistake saying that the login file doesnt exist. home will throw an exception if i do this, but failed_attempt wont.</p>
  
  <pre><code>  include_once("../StoredProcedure/connect.php");
  </code></pre>
  
  <p>include_once("../untitled/sanitize_string.php");</p>
  
  <p>and if I do this:</p>
  
  <pre><code>   include_once("StoredProcedure/connect.php");
     include_once("untitled/sanitize_string.php");
  </code></pre>
  
  <p>the opposite happens, failed_attempt throws an exception , but home, wont. How do I fix this..</p>
  
  <p>Do I tell the include to go up a page by putting this ../ , and therefore home.php doesnt need to go one page up therefore it throws that exception..</p>
  
  <p>How can I make it so both files accept those inclueds as valid.. perhaps not relative to where they are placed.. i.e. without that ../</p>
  
  <p>Directory structure:</p>
  
  <pre><code>PoliticalForum
  -&gt;home.php
  -&gt;StoredProcedure/connect.php
  -&gt;untitled/sanitize_string.php
  -&gt;And other irrelevant files
  </code></pre>