Search code examples
phpconfigurationstorageflat-file

Storing Configuration without MySQL


I want to be able to store website configuration without the use of mysql. I also want the user to be able to change this information from a web page. What's the best methods to do so?


Solution

  • Valuable options are a SQLite database, or just a PHP file containing a serialized array if you want a really simple option:

    // reading configuration
    $config = unserialize(file_get_contents('config'));
    
    // storing configuration
    file_put_contents('config', serialize($config));