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

Writing to config.php

Discussion in 'XenForo Development Discussions' started by Robust, Oct 15, 2015.

  1. Robust

    Robust 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?
     
  2. Chris D

    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.
     
    Robust, Daniel Hood and Marcus like this.

Share This Page