views:

79

answers:

4

My php program is broken up into modules and each module has its own settings. These settings will hardly change, so would it be better to put the settings in a ini file or in a mysql database?

If I go with the ini style then how hard is it to update the ini file?

+1  A: 

If I go with the ini style then how hard is it to update the ini file?

As hard as opening an editor (e.g. two keystrokes: vi). You should document your settings properly. Anyway this approach should be preferred over storing configuration settings (even seldom used ones) in the database.

The MYYN
+1  A: 

Static site-wide configuration settings are probably best stored in configuration files (INI or XML). User specific configuration settings (ie. user specified theme, language selection) are probably better stored in a database (though you could just as well store these in uniquely named config files).

As for how hard it is to update the ini file : that will depend on the number of settings you store in it. To make this a bit easier on yourself you could create sections per module, so you can jump to the relevant section and quickly change the config vars.

ie.

[module1]
var1=value1
var2=value2
...
[module2]
varX=valueX
varY=valueY
...
wimvds
+3  A: 

A simple text file for configuration has several advantages. Most of all you can use a version control system to compare revisions and to list the history of your configuration files. Another advantage is, that you dont need a special tool to write/change configuration settings. Just fire up a text editor (VI that is ;-) )

tweber
+1  A: 

You could also take out the middle man and have the config stored in a PHP array (no need to parse an INI, or XML, or whatever if that's the case). Really depends on who would end up maintaining the file (developer or non)

joshtronic