Problems with PHP Include pointing to parent directory

Discussion in 'General troubleshooting' started by Stewlacher54, Oct 14, 2013.

  1. A few months back, all my sites hosted here stopped working when I use a PHP include file pointing to a directory up a level from the current page. For example:

    <?
    include '../inc/footer.php';
    ?>

    Stopped working. If I copy the include files to each folder and point to them directly, that works fine, but anything up a directory level doesn't work, and I don't see any errors, it just doesn't include the files. Is there a setting I can change to allow this? I'm not sure what changed to make this stop working, if it was something I did or a server setting Winhost changed. Any ideas? Thanks!

    -Shawn
     
    Last edited by a moderator: Oct 14, 2015
  2. Shawn, try this instead:

    <?
    include ($_SERVER['DOCUMENT_ROOT'].'/inc/footer.php');
    ?>

    I don't think anything changed as far as php version or anything in the past few months, though the global php.ini may have changed...
     

Share This Page