[ciapug] DB Manager Configuration file best practice?

Dave J. Hala Jr. dave at 58ghz.net
Thu Mar 23 17:28:31 CST 2006


You could also put these .inc files outside of the document root,

 

On Thu, 2006-03-23 at 14:20, David Champion wrote:
> Is this a scope issue? You could include the _dbconfig.inc in your class 
> code, or wherever you're instantiating the db object, and set the 
> properties for the object...
> 
> BTW - I would recommend that you don't name include files .inc. If you 
> don't specifically configure your web server to deny showing this file 
> type on every server you're using it on, people will be able to do this:
> 
> http://yourserver.com/_dbconfig.inc
> 
> ... and see the contents of that file.
> 
> -dc
> 
> Wade Arnold wrote:
> > I am wondering if anyone has a best practice for setting up a configuration
> > file for my database connection variables
> > 
> > In the past I have used the code below but now that I am using classes it
> > fails to declare the constant. Any ideas or tidbits of wisdom?
> > 
> > Thanks;
> > Wade Arnold
> > 
> > <?php
> > // this will be in your DBManager.php
> > require_once dirname(__FILE__).'./conf/_dbconfig.inc';
> > 
> > echo DB_USER;
> > echo DB_PASSWORD;
> > echo DB_PASSWORD;
> > echo DB_HOST;
> > ?>
> > 
> > 
> > <?php
> > // name this file _dbconfig.inc
> > 
> > /**
> >  * Thide defines CONSTANTS
> >  */
> > define( 'DB_USER', 'wadearno_bvlt1' );      // your MySQL username
> > define( 'DB_PASSWORD', 'zorwvMw5OV2L' );  // ...and password
> > define( 'DB_PASSWORD', 'wadearno_bvlt1' );   // the name of the database
> > define( 'DB_HOST', 'localhost' );     // mySQL Server (typically
> > 'localhost')
> > ?>
> > 
> > _______________________________________________
> > ciapug mailing list
> > ciapug at cialug.org
> > http://cialug.org/mailman/listinfo/ciapug
> > 
> 
> 
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
-- 

Open Source Information Systems, Inc. (OSIS)
Dave J. Hala Jr., President <dave at osis.us>
641.485.1606



More information about the ciapug mailing list