title: PHP: include inside included file
body: <p>I've gotta solve this once and for all.</p>
  
  <p>I'm currently working on a 4 years old project, written in PHP and that is run on Apache server.<br>
  We are a team of about 40 folks and each of us uses the prefered OS, so we have Windows, Macs and Linuxes running this code. I'm among those who prefer Ubuntu.</p>
  
  <p>Anyway, everytime I clone this project, I have to modify some portions of code so it'll work in my machine, because of the following old <code>include</code>/<code>require</code> issue:<br>
  So suppose I have the following files and dirs:</p>
  
  <pre><code>root/
  |   index.php
  |   framework/
      |   index.php
      |   framework.php
  |   config.php
  </code></pre>
  
  <p>Summarizing:</p>
  
  <ul>
  <li><code>root/index.php</code> does <code>require('framework/index.php')</code></li>
  <li><code>root/framework/index.php</code> does <code>require('../config.php')</code> and <code>require('framework.php')</code></li>
  <li>Obviously, the code above gives me an error on the first <code>require</code>, because it's looking for <code>config.php</code> in the directory in which <code>root</code> folder is located at.</li>
  </ul>
  
  <p>Yes, I do know that we should use some constants like <code>define('ROOT_DIR', path)</code> or use <code>dirname(__DIR__)</code> inside requires. My problem is that <strong>this very code runs flawlessly on some machines around here</strong> (including the production server, which also runs Ubuntu LTS), so it's believed that <strong>this error is due to an Apache or PHP configuration</strong>.
  I must run this code locally for development, but there're just too many <code>include</code> and <code>require</code>, and they won't let me change all of the original project's <code>require</code> so it contains <code>dirname(__DIR__)</code> or whatever bu****it in it, as it's believed to be unecessary.</p>
  
  <p>So, please don't suggest me to do anything to the preexisting <code>require</code> calls. I need to know how to change PHP (or maybe another service's) configuration so when it requires files, it'll check them in relation to the script that is requiring the files, not in relation to the very first script that started this <code>require</code> chain.</p>
  
  <p>Maybe this is not relevant, but everytime I reinstall Apache2 and PHP5 on my Ubuntu LTS 14.04, its default configurations are so that this code doesn't run. One of my coworkers, who uses Windows (used to run 8.1, now he's running 10), never has this problem, as in Windows apparently the XAMP or WAMP or whatever he uses has default configurations that will allow this code to work.</p>
  
  <p>Please help. Thanks in advance.</p>