Re: Store database password outside of public_html folder

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux