Support » Fixing WordPress » Can’t include files in other directories

  • Resolved McGuirk


    I’ve been using includes in a couple of different files (such as index.php in one of my theme directories) and it has worked fine as long as the file I’m trying to include is in the same directory as the file WITH the include.

    In other words, I have this in my index.php file:

    if(date('j') == '1') {

    This works fine, assuming 1.php is in the same directory as index.php. What I need is to be able to do the same thing with 1.php residing in a subdirectory, such as:

    if(date('j') == '1') {

    But that never seems to work. It renders the whole page fine (since it’s just an include) but nothing shows up where the stuff from 1.php should be.

    Anybody know the secret to this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Nobody? 🙁

    I believe you need the full server path to the include. NOT the http:// path, and NOT a relative path, as you currently have. Just the full server path.

    True, but that isn’t working either.


    That’s weird. Full server path works fine for me all the time. You’re not getting any errors? Have you checked with your host to see if they disallow server-path access for some reason?

    Ok I figured it out with some help from my server admin. We had php running in safe mode which meant that in order for everything to work all the files had to have the same owner. Since somebody else owned all of the wordpress install files and I owned these new files there was a problem. Everything is fixed now that I have ownership of the whole enchilada. Thanks for the help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can’t include files in other directories’ is closed to new replies.