title: PHP Relative paths for require file
body: <p>I've been going over those two topics:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/13104277/include-require-and-relative-paths">include, require and relative paths</a></li>
  <li><a href="https://stackoverflow.com/questions/1954750/php-with-require-once-include-require-the-path-is-relative-to-what">PHP - with require_once/include/require, the path is relative to what?</a></li>
  </ul>
  
  <p>and couldn't make my script to work, none of presented methods are working or maybe I'm doing something wrong.</p>
  
  <p>Anyway this is where my problem occurred:</p>
  
  <pre><code>Root/                                   //this is root location for server
  APP/                                    //this is root location for script
  Root/APP/core/init.php                  //this is where I include classes and functions from
  Root/APP/classes/some_class.php         //this is where all classes are
  Root/APP/functions/some_function.php    //this is where all functions are
  </code></pre>
  
  <p>and so obviously I need to include <code>init.php</code> everywhere so I did in every file like this:</p>
  
  <pre><code>require_once 'core/init.php';
  </code></pre>
  
  <p>it was working until I have decided to create a location for admin files like this:</p>
  
  <pre><code>Root/APP/Admin/some_admin_file.php
  </code></pre>
  
  <p>and when I included init this way:</p>
  
  <pre><code>require_once '../core/init.php';
  </code></pre>
  
  <p>script failed to open functions, no such file in <code>APP/Core/</code> folder
  so I used DIR method presented in topic above and than even weirder thing happened, error:</p>
  
  <blockquote>
    <p>no such file in APP/Core/classes/Admin/</p>
  </blockquote>
  
  <p>What is that? :D I'm lost with this, could someone help a bit ;)</p>