Using SQLite for configuration management Using SQLite for configuration management sqlite sqlite

Using SQLite for configuration management


That really depends on how large your configuration files are going to be and how many of them you are going to store.

PHP handles ini files quite well and it seems to be a popular choice amongst PHP frameworks.

Other popular approaches:

  • XML
  • YAML
  • files containing JSON


For the configuration values I would suggest you to use INI files and handle it with parse_ini_file function which is a lot more easier way than resorting to SQLlite.


Consider serializing/unserializing an array for small configuration settings:

<?php# create settings array$settings = array(    'setting1' => 'on',    'setting2' => 'off',    'setting3' => true,);# save it$filename = 'settings.txt';file_put_contents($filename,serialize($settings));# retrieve it$getSettings = unserialize(file_get_contents($filename));    # modify it    $getSettings['addedLater'] = 'new value';    # save it again.    file_put_contents($filename,serialize($getSettings));    # rise and repeat?>