WordPress, for example, has a table with name => value rows for storing application-wide settings (the name of the blog, comments settings, etc.). Please note that I’m referring to settings that may be modified often during normal use of the application.
I understand why WordPress does it like that (portability: it’s easy to copy the entire database to another blog and retain settings), but is there a better way to do it for smaller applications?
I know that many frameworks, like Zend Framework for example, have a configuration file with application-wide configuration settings. Why not just dynamically modify that file at runtime to save my settings? To me, this has several advantages over database settings storage:
- Less database use
- Settings are easily human-editable over FTP without needing a MySQL shell or phpMyAdmin instance
- Settings files can easily be backed up and restored
On the other hand, the biggest complication I can think of is that of concurrency. The file will need to be locked while changes are being made.
What is the preferred way?
DB table advantages
valuecolumns of different types used exclusively…and disadvantages