I am creating something similar to a Content Management System, that can be downloaded and used by everyone that needs it. I've been working in web-development for a couple of years (mainly as a hobby, i.e. creating personal homepages for acquaintances), but have never had the need of a user to enter his own configurations (let it be database connection, meta-data about his site, desired behaviour of the website).
Therefore I have no experience with custom configuration file handling. That's where my question lies: What is the best practice to handle custom website-wide configuration files and handle them in PHP?
I have thought of creating INI-files, that can be customized from within the admin panel and that are hidden to the user by .htaccess for security purposes. However I don't know if INI is the best method to do this considering that the page is being developed to be extensible through plugins (which may lead to another question soon).
So what is my best bet to handle configurability? For instance do I want to store database configuration in files somehow and have other configurations outsourced to the database itself? Or do I store everything in INI-files (also considering configurability for plugins: Should everyone of these have their own config-file)?
Best Answer
Have you looked at other CMS and how they approach the problem?
For example, Drupal configuration responds to all your current needs and shows one possible way to not being limited by the constraints of INI.
You may also consider:
If you're working with end-users who don't have technical background, the last solution is the only one viable.
Applications like PHPBB show how to make two-step configuration: when the application runs for the first time, it executes setup.php which asks for the connection string, the root password, etc. Once the app is installed, the administrator can log in to access the administration panel.