NYCPHP Meetup

NYPHP.org

[nycphp-talk] Local File versus DB-based configuration setting strategy

lars gelfan ldgphp at www.ldgmedia.com
Sat Jul 8 14:30:53 EDT 2006


If you already have a database connection open then the extra hit is really a non-issue and 
theoretically would be faster than reading from a text file. I had the same situation where my config 
file for an application we develop grew fairly large so we put it in a database and have been happy 
with that set up. It also made it easier for us to add some of the values stored there to the admin 
tools so the client can change some of them as needed. The application is reliant on the database, so 
if it went down, the users wouldn't be able to do anything anyway and almost every page opens a 
database connection.

As far as serializing the data, I guess it depends on what information you are passing and how much 
work PHP has to do with it. I don't think you would gain too much unless it makes things easier for 
you code-wise for some reason. I don't think we are serializing any of the config info from what i can 
recall atm, but we do serialize some of the users' information for saved search queries and such so 
we can pass those values right back into PHP without having to reformat the data.

-L.



> 
>  > Obviously the database info can't be kept in the database, but beyond
>  > that, most everything can.
> 
> This adds an extra database hit for every request for no good 
> reason.  Bad idea.
> 



More information about the talk mailing list