Writing to config.php


Well-known member
What's the best way to go about writing new values to config.php? Using an object or function, or directly writing to it? In other words, best practice?

Chris D

XenForo developer
Staff member
I wouldn't say there is a best practice for that...

Whatever automated method you're going to use to write to it is going to require permissions to do so. The config.php file location is not somewhere XF requires to be writable and it quite often isn't.

Generally, if you have a setting that can be controlled inside the software, the setting value should be stored inside the software - that being using the option system, session or other database storage - config.php isn't really designed or suitable for this use case.