1

I am trying to direct a scripts include out of it's sub-directory back to the root directory and into includes/config.php

I'v done this, but it doesn't seem to be working on my webhost, it works fine on localhost though;

include_once "../includes/config.php";

The directory the file that contains the include in is only one sub-directory deep so I figured ../ would work, which it did on localhost but for some reason it doesn't work when I upload it to my localhost.

Could anyone explain why this isn't working?

MPelletier
  • 16,256
  • 15
  • 86
  • 137
Ben F
  • 27
  • 6
  • I had a similar problem, which wound up being related to security configs: http://stackoverflow.com/questions/8998743/rhel-php-writing-files-outside-var-www-html – PaulProgrammer Jun 03 '13 at 23:26
  • The permissions on the directory may need to be changed – Yeak Jun 03 '13 at 23:46
  • Switched it over to absolute paths, thank you fabio, little extra work but it gets the job done. – Ben F Jun 03 '13 at 23:54
  • Please don't use absolute paths. Or you will hate both yourself and @Fabio once you have to migrate the site. Use either `dirname(__FILE__) . '/relative/path/to/file.php'` or `__DIR__ . '/relative/path/to/file.php'`. http://php.net/manual/en/language.constants.predefined.php – PeeHaa Jun 04 '13 at 15:37

0 Answers0