Re: secure database info in different environments

From: Date: Tue, 03 Apr 2007 09:12:14 +0000
Subject: Re: secure database info in different environments
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-251964@lists.php.net to get a copy of this message
Bruce Cowin wrote: > Hi, > > I have a generic database class that I built to connect to our different databases. From other > posts that I've read, I think the safe thing is for me to put this file outside the web root, > ensure it has a .php extension, set the include path to include this folder and include it in any > pages that require it. Is this correct? > > Also, how do you handle the different environments: dev, test, and prod? I don't want to > have to change the code every time I copy the file over. Do I have an independent file that > determines if that folder should point to dev/test/prod? I generally use CVS to store my work and also to 'publish' stuff onto different setups/machines for testing/production, rather than moving/copying files manually - I find it alot easier to type 'cvs up -r SOME_TAG' and just have all the files updated with out having to think about which exactly files I must copy. I usually end up with a small config file that is not included in the [cvs] project (so it must be created manually for/in each installation) and have the project 'init' code check for the config file, require it and then test for the existance of some required constants/variables/etc - if the file is missing, not readable or expected constants/vars/etc are missing then the app dies with a suitable error message. > > Thanks for your help. > > > > Regards, > > Bruce >

« previous php.general (#251964) next »