views:

44

answers:

2

I'm developing a PHP application where I have to store configuration variables.

Using MySQL would be overkill, because it's a CLI app I'm talking about and there are only a couple of configuration variables.

I don't know about INI files... I'm thinking of using SQLite.

What do you think? It is too overkill using SQLite? Do you suggest using other approaches?

A: 

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
Lior Cohen
A: 

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.

Sarfraz
I want to write to the config files too. I saw a lot of method to just read the entire config file, manipulate it and overwrite the entire config file.I think that's not very efficient
feketegy
@feketegy - How often will you be writing to these config files? I doubt efficiency is going to matter.
Peter Bailey
Quite often. I have to track update times in these files. This CLI php will be tied to a cron job and ran in every 5 minutes
feketegy