php.ini include_path Issue
Posted: Sat Jan 17, 2009 9:50 am
Hi,
I am working on a somewhat large web site, and I would like to keep my include files out of the web root for security's sake. I have all of my website code in a directory inside the web root, and the include directory one level above the web root.
So, if I'm at example.com/dir1/index.php and I would like to include a file from the include directory, I would use
This much is working. However, I would like to set up php.ini so I can leave out the '../../include' in the require statements. That is, I would like this code: to really execute this statement:
Additionally, I would like to have php.ini handle multiple level directories. So, if I was to be at example.com/dir1/dir2/file.php, I would still like to be able to call . I've tried adding this to my php.ini file, but it didn't work:
I'm hosted on a Linux environment, if that helps anything.
I would greatly appreciate any help you could give. Thanks,
Zach
I am working on a somewhat large web site, and I would like to keep my include files out of the web root for security's sake. I have all of my website code in a directory inside the web root, and the include directory one level above the web root.
So, if I'm at example.com/dir1/index.php and I would like to include a file from the include directory, I would use
Code: Select all
require_once('../../include/mysql/file.php');Code: Select all
require_once('mysql/file.php');Code: Select all
require_once('../../include/mysql/file.php);Code: Select all
require_once('mysql/file.php');Code: Select all
:../../IncludeI would greatly appreciate any help you could give. Thanks,
Zach