title: Project base directory PHP
body: <p>I'm working on a project organized this way:</p>
  
  <pre><code>public_html/
     index.php
     file1.php
     file2.php
     ...
     css/
        basic.css
     panel/
        file3.php
        ...
  resources/
     classes/
        class1.php
        class2.php
        ...
     core/
        init.php
     includes/
        templates/
           header.php
           footer.php
  </code></pre>
  
  <p>Here is a part of what I have got in my <code>init.php</code> file:</p>
  
  <pre><code>spl_autoload_register(function ($class) {
      require_once '../resources/classes/' . $class . '.php';
  }
  );
  </code></pre>
  
  <p>In every php file, I simply require <code>init.php</code>:</p>
  
  <pre><code>&lt;?php
  
  require_once '../resources/core/init.php';
  </code></pre>
  
  <p>I get the result with files inside <code>public_html</code> folder, but when I do this with files inside <code>panel</code> subfolder, PHP can't find my classes (same thing for templates).
  I would like to know, what is the best way to deal with this problem?</p>
  
  <p>P.S I'm working on <code>localhost/</code></p>
  
  <p>Also inside header.php:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;link rel="stylesheet" href="css/basic.css" type="text/css" /&gt;
          &lt;title&gt;&lt;?php echo $title ?&gt;&lt;/title&gt;
      &lt;/head&gt;
  </code></pre>
  
  <p>When calling it from <code>public_html</code> folder, everything works just fine, when calling from <code>panel</code> subfolder, no CSS...</p>