title: Best practice for PHP paths
body: <p>I have been all over the Internet trying to figure out the best way to handle paths in my website. Should I use relative paths, absolute paths?</p>
  
  <p>I have seen dirname (<strong>FILE</strong>) mentioned several times. One problem I have with relative paths is that PHP files which are included by several other files at different directory levels cause the relative paths to break. For example if the directory structure is</p>
  
  <pre><code>Root
      A
      B
         b
  </code></pre>
  
  <p>And a PHP file in b and An include another file from B then the relative paths for the code in the file in B will be different.</p>
  
  <p>So in general what is the best way to handle paths to files with regards to includes and file operations within the code.</p>