Why is this “require” causing a fatal error?-Collection of common programming errors
I inherited a file called promo.php. It begins with the lines:
define('ROOT', dirname(dirname(dirname(__FILE__))));
require_once ROOT. '/app/config/database.php';
require_once ROOT. '/app/config/constants.php';
And works well enough. For testing purposes though I created a file called promo-2.php in the same folder, beginning with the same lines. In this case, the file dies with a fatal error at at the first require.
As far as I can make out, the required file is not being found. But how can this be the case when promo-2.php is in the some directory as promo.php? Surely ROOT will be the same in both places? Could there be some kind of permissions issue that I haven’t thought of? All suggestions gratefully received!