Is this system for a user to use on their own site or are you hosting the thing yourself. If the latter, I can't see why the need to choose, as it's under your control, so I assume it's a system that users can download and install onto their own systems.
Using file based storage is a bit draconian, but if you insist on giving them the option, then I can't see anything wrong with using a webpage to allow them to change the contents of a different file. Your config file could be in XML, plain text (like CSV), json - any format that can be read and parsed by php. So IMO, you could read the contents of your config file to a form and then overwrite the file with new content.
You just need to ensure that any data help in the files can be transferred easily to a newly created DB. That can be fiddly.
diafol
Keep Smiling
10,842 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,536
Skill Endorsements: 61
What the config page is a php file?
I can't see why you can't open it, parse it and then replace a line in it. Not my choice of storage format, but should be fine.
diafol
Keep Smiling
10,842 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,536
Skill Endorsements: 61
All you need to do is this:
$string = file_get_contents('config.php');
$overwrite = str_replace('$storage=\'file\';','$storage=\'db\';',$string);
file_put_contents('config.php',$overwrite);
THat's just a simple way - you'd probably need to use additional safeguards like file_exists() or even do a preg_replace() instead of a str_replace.
The use of single quotes is important, as double quotes will try to use the values of $storage. However you could escape the $ (\$) if you want to use double quotes - just remember to unescape the single quotes in the string.
diafol
Keep Smiling
10,842 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,536
Skill Endorsements: 61
No prob. Blwyddyn Newydd Dda i ti hefyd (Happy New Year).
If solved, mark it so. :)
diafol
Keep Smiling
10,842 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,536
Skill Endorsements: 61
Question Answered as of 1 Year Ago by
diafol