Re: [PHP] Store database password outside of public_html folder
- From: japruim@xxxxxxxxxx (Jason Pruim)
- Date: Mon, 4 Aug 2008 08:59:52 -0400
On Aug 4, 2008, at 7:54 AM, Don Don wrote:
Hi All,
I've been reading on the internet that is most secure to store your database details outside of the public accessible folder.
I am a bit stuck on how to do this.
I've got a folder "db_details" that contains the file "dbdetails" which contains the database login info. I normally include this file in any page requiring database connectivity e.g. include_once("db_details/dbdetails.php")
How can I now set this up so that the folder/files for the database are stored outside of the public_html folder ?
Hi Don,
Basically you move it 1 level above the root of your website. So if your website root is: /www/public_html you would put it here: /www/ db_details and then set your include path with:
<?PHP
ini_set("include_path","/path/to/www/db_details:/path/to/other/include/ folders");
?>
and just do that at the top of each page that needs to reference any of your included files and you'll be all set. Personally I use a file called defaults.php that has alot of that type of stuff in it. References to where I keep things, system wide variables things like that.
Works out quite well and no one has told me I'm doing it wrong yet :)
--
Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
japruim@xxxxxxxxxx
.
- References:
- Store database password outside of public_html folder
- From: Don Don
- Store database password outside of public_html folder
- Prev by Date: Store database password outside of public_html folder
- Next by Date: Re: How to jump into and loop through XML element
- Previous by thread: Store database password outside of public_html folder
- Index(es):
Relevant Pages
|