Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql vs ini files?

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?

like image 675
WAC0020 Avatar asked Jun 28 '10 13:06

WAC0020


2 Answers

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 ;-) )

like image 131
towe75 Avatar answered Nov 20 '22 09:11

towe75


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
...
like image 1
wimvds Avatar answered Nov 20 '22 09:11

wimvds