Config values that can only be set in config/local.config.php ========================================================== * [Home](help) Friendica's configuration is done in two places: in PHP array configuration files and in the `config` database table. Database config values overwrite the same file config values. ## File configuration The configuration format for file configuration is an array returned from a PHP file. This prevents your webserver from displaying your private configuration. It interprets the configuration files and displays nothing. A typical configuration file looks like this: ```php [ // Comment line 'key' => 'value', ], 'section2' => [ 'array' => ['value0', 'value1', 'value2'], ], ]; ``` ### Configuration location The `config` directory holds key configuration files and can have different config files. All of them have to end with `.config.php` and must not include `-sample` in their name. Some examples of common known configuration files: - `local.config.php` holds the base node custom configuration. - Any other file in this folder is meant for additional configuration (e.g. for addons). Addons can define their own default configuration values in `addon/[addon]/config/[addon].config.php` which is loaded when the addon is activated. If needed, an alternative `config` path can be used by using the `FRIENDICA_CONFIG_DIR` environment variable (full path required!). This is useful in case of hardening the system by separating configuration from program binaries. ### Static Configuration location The `static` directory holds the codebase default configurations files. They must not be changed by users, because they can get changed from release to release. Currently, the following configurations are included: - `defaults.config.php` holds the default values for all the configuration keys that can only be set in `local.config.php`. - `settings.config.php` holds the default values for some configuration keys that are set through the admin settings page. #### Migrating from .htconfig.php to config/local.config.php The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release. The migration is pretty straightforward: If you had any addon-specific configuration in your `.htconfig.php`, copy `config/local-sample.config.php` to `config/addon.config.php` and move your configuration values. Afterwards, copy `config/local-sample.config.php` to `config/local.config.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `.htconfig.php` to check your node is working as expected before deleting it.
.htconfig.php | config/local.config.php |
---|---|
$db_host = 'localhost'; $db_user = 'mysqlusername'; $db_pass = 'mysqlpassword'; $db_data = 'mysqldatabasename'; $a->config["system"]["db_charset"] = 'utf8mb4'; |
'database' => [ 'hostname' => 'localhost', 'username' => 'mysqlusername', 'password' => 'mysqlpassword', 'database' => 'database', 'charset' => 'utf8mb4', ], |
$a->config["section"]["key"] = "value"; |
'section' => [ 'key' => 'value', ], |
$a->config["section"]["key"] = array( "value1", "value2", "value3" ); |
'section' => [ 'key' => ['value1', 'value2', 'value3'], ], |
$a->config["key"] = "value"; |
'config' => [ 'key' => 'value', ], |
$a->config['register_policy'] = REGISTER_CLOSED; |
'config' => [ 'register_policy' => \Friendica\Module\Register::CLOSED, ], |
$a->path = "value"; |
'system' => [ 'urlpath' => 'value', ], |
$default_timezone = "value"; |
'system' => [ 'default_timezone' => 'value', ], |
$pidfile = "value"; |
'system' => [ 'pidfile' => 'value', ], |
$lang = "value"; |
'system' => [ 'language' => 'value', ], |
config/local.ini.php | config/local.config.php |
---|---|
[database] hostname = localhost username = mysqlusername password = mysqlpassword database = mysqldatabasename charset = utf8mb4 |
'database' => [ 'hostname' => 'localhost', 'username' => 'mysqlusername', 'password' => 'mysqlpassword', 'database' => 'database', 'charset' => 'utf8mb4', ], |
[section] key = value |
'section' => [ 'key' => 'value', ], |
[config] register_policy = REGISTER_CLOSED |
'config' => [ 'register_policy' => \Friendica\Module\Register::CLOSED, ], |
[section] key[] = value1 key[] = value2 key[] = value3 |
'section' => [ 'key' => ['value1', 'value2', 'value3'], ], |