• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Writing to config.php

Robust

Well-known member
#1
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
#2
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.