Re: [PHP] Store database password outside of public_html folder




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




.



Relevant Pages

  • Re: Is This Possible ... ? Yes - Upload images to an Access database
    ... It looks like your databases folder is outside the root of your web ... I created a database exactly as you said, the only change I made was to ... and underneath an 'upload' button and a 'view images' button. ... Dim con As New Data.OleDb.OleDbConnection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Have database mismatch, can I move NTDS.dit and Exchange to new identical server?
    ... Check the physical location of the Winnt\NTDS\ folder. ... Check the permissions on the \Winnt\NTDS folder. ... as it may not be the database that is the ... MCSA + Exchange ...
    (microsoft.public.win2000.active_directory)
  • RE: Sharepoint Backup & Restore
    ... even you have moved the Sharepoint database to another location. ... You can delete the $NtUninstallxxxxxx$ folder to free up space. ... Perform an online backup of the Exchange 2003 Information Store to purge ...
    (microsoft.public.windows.server.sbs)
  • Re: Help - locked out of database
    ... IT checked all the permissions and everything seems to be ok. ... "Joan Wild" wrote: ... I have poured a year into this database - is there someway to recover this? ... You need, at minimum, modify permission on the folder. ...
    (microsoft.public.access.security)
  • Re: How to Link a file instead of embeding in Access Table
    ... There will be multiple folder in time, but right now, I will ... visio drawing in the database. ... It's usually simpler just to store the names and locations ... Could I use that if I put a OLE ...
    (microsoft.public.access.externaldata)