» Configuring DB Connections In A Web App
Wednesday, June 25th, 2008As we continue to press the evolution of our SaaS projects we are coming across some age-old problems that amazingly are still alive & well in today’s dev environment. The part that makes it amazing is that I’ve seen this issue over and over in the past 20+ years of software development. While I’ve seen some unique “tricks” to get around some of the problems nothing earth-shatteringly different has come about.
The most recent issue, which I’m putting up for discussion here, is how to configure a web app so that the independent developer copies, the staging copy, and the live copy each have their own database. Yeah, a “just change the config file” trick would work; and sadly is the defacto standard for thousands of PHP apps scattered around web boxes these days. I’ve also seen some convoluted start up code that changes your DB configs based on your environment. I don’t like either solution, both of which I’ve posted below to outline the common technique.












