2018-11-25 07:56:02 +01:00
Config values that can only be set in config/local.config.php
2018-06-29 06:26:00 +02:00
==========================================================
2015-10-04 12:02:44 +02:00
2016-12-06 15:03:57 +01:00
* [Home ](help )
2018-11-25 07:56:02 +01:00
Friendica's configuration is done in two places: in PHP array configuration files and in the `config` database table.
2018-06-28 05:07:38 +02:00
Database config values overwrite the same file config values.
2018-07-17 08:03:39 +02:00
## File configuration
2018-06-28 05:07:38 +02:00
2018-11-25 07:56:02 +01:00
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.
2018-06-28 05:07:38 +02:00
A typical configuration file looks like this:
```php
2018-11-25 07:56:02 +01:00
< ?php
/*
* Comment block
*/
return [
'section1' => [
// Comment line
'key' => 'value',
],
'section2' => [
'array' => ['value0', 'value1', 'value2'],
],
];
2018-06-28 05:07:38 +02:00
```
2018-07-17 08:03:39 +02:00
### Configuration location
2018-06-28 05:07:38 +02:00
2019-06-23 19:56:21 +02:00
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.
2018-06-28 05:07:38 +02:00
2019-06-23 19:56:21 +02:00
Some examples of common known configuration files:
2018-11-25 07:56:02 +01:00
- `local.config.php` holds the current node custom configuration.
- `addon.config.php` is optional and holds the custom configuration for specific addons.
2018-07-17 08:03:39 +02:00
2018-11-25 07:56:02 +01:00
Addons can define their own default configuration values in `addon/[addon]/config/[addon].config.php` which is loaded when the addon is activated.
2018-07-17 08:03:39 +02:00
2021-09-11 14:33:26 +02:00
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.
2019-06-23 19:56:21 +02:00
### 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.
2018-11-25 07:56:02 +01:00
#### Migrating from .htconfig.php to config/local.config.php
2018-06-28 05:07:38 +02:00
The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
2018-07-17 08:03:39 +02:00
The migration is pretty straightforward:
2018-11-25 07:56:02 +01:00
If you had any addon-specific configuration in your `.htconfig.php` , just copy `config/addon-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.
2018-06-28 05:07:38 +02:00
< style >
table.config {
margin: 1em 0;
background-color: #f9f9f9 ;
border: 1px solid #aaa ;
border-collapse: collapse;
color: #000 ;
width: 100%;
}
table.config > tr > th,
table.config > tr > td,
table.config > * > tr > th,
table.config > * > tr > td {
border: 1px solid #aaa ;
padding: 0.2em 0.4em
}
table.config > tr > th,
table.config > * > tr > th {
background-color: #f2f2f2 ;
text-align: center;
width: 50%
}
< / style >
< table class = "config" >
< thead >
< tr >
< th > .htconfig.php< / th >
2018-11-25 07:56:02 +01:00
< th > config/local.config.php< / th >
2018-06-28 05:07:38 +02:00
< / tr >
< / thead >
< tbody >
< tr >
< td > < pre >
$db_host = 'localhost';
$db_user = 'mysqlusername';
$db_pass = 'mysqlpassword';
$db_data = 'mysqldatabasename';
$a->config["system"]["db_charset"] = 'utf8mb4';
< / pre > < / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'database' => [
'hostname' => 'localhost',
'username' => 'mysqlusername',
'password' => 'mysqlpassword',
'database' => 'database',
'charset' => 'utf8mb4',
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
< tr >
< td > < pre >
$a->config["section"]["key"] = "value";
< / pre > < / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'section' => [
'key' => 'value',
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
< tr >
< td > < pre >
$a->config["section"]["key"] = array(
"value1",
"value2",
"value3"
);
< / pre > < / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'section' => [
'key' => ['value1', 'value2', 'value3'],
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
< tr >
< td > < pre >
$a->config["key"] = "value";
< / pre > < / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'config' => [
'key' => 'value',
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
2018-11-27 08:46:37 +01:00
< tr >
< td > < pre >
$a->config['register_policy'] = REGISTER_CLOSED;
< / pre > < / td >
< td > < pre >
'config' => [
2019-01-30 07:21:25 +01:00
'register_policy' => \Friendica\Module\Register::CLOSED,
2018-11-27 08:46:37 +01:00
],
< / pre > < / td >
< / tr >
2018-06-28 05:07:38 +02:00
< tr >
< td > < pre >
$a->path = "value";
< / pre > < / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'system' => [
'urlpath' => 'value',
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
< tr >
< td > < pre >
$default_timezone = "value";
< / pre > < / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'system' => [
'default_timezone' => 'value',
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
< tr >
< td > < pre >
$pidfile = "value";
< /pre>< / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'system' => [
'pidfile' => 'value',
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
< tr >
< td > < pre >
$lang = "value";
< / pre > < / td >
< td > < pre >
2018-11-25 07:56:02 +01:00
'system' => [
'language' => 'value',
],
2018-06-28 05:07:38 +02:00
< / pre > < / td >
< / tr >
2018-11-25 07:56:02 +01:00
< / tbody >
< / table >
#### Migrating from config/local.ini.php to config/local.config.php
The legacy `config/local.ini.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 `config/addon.ini.php` , just copy `config/addon-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 `config/local.ini.php` file to check your node is working as expected before deleting it.
2018-06-28 05:07:38 +02:00
2018-11-25 07:56:02 +01:00
< table class = "config" >
< thead >
< tr >
< th > config/local.ini.php< / th >
< th > config/local.config.php< / th >
< / tr >
< / thead >
< tbody >
< tr >
< td > < pre >
[database]
hostname = localhost
username = mysqlusername
password = mysqlpassword
database = mysqldatabasename
charset = utf8mb4
< / pre > < / td >
< td > < pre >
'database' => [
'hostname' => 'localhost',
'username' => 'mysqlusername',
'password' => 'mysqlpassword',
'database' => 'database',
'charset' => 'utf8mb4',
],
< / pre > < / td >
< / tr >
< tr >
< td > < pre >
[section]
key = value
< / pre > < / td >
< td > < pre >
'section' => [
'key' => 'value',
],
< / pre > < / td >
< / tr >
2018-11-27 08:46:37 +01:00
< tr >
< td > < pre >
[config]
register_policty = REGISTER_CLOSED
< / pre > < / td >
< td > < pre >
'config' => [
2019-01-30 07:23:47 +01:00
'register_policy' => \Friendica\Module\Register::CLOSED,
2018-11-27 08:46:37 +01:00
],
< / pre > < / td >
< / tr >
2018-11-25 07:56:02 +01:00
< tr >
< td > < pre >
[section]
key[] = value1
key[] = value2
key[] = value3
< / pre > < / td >
< td > < pre >
'section' => [
'key' => ['value1', 'value2', 'value3'],
],
< / pre > < / td >
< / tr >
2018-06-28 05:07:38 +02:00
< / tbody >
< / table >
2018-11-25 07:56:02 +01:00
2018-07-17 08:03:39 +02:00
### Database Settings
2018-06-28 05:07:38 +02:00
The configuration variables database.hostname, database.username, database.password, database.database and database.charset are holding your credentials for the database connection.
If you need to specify a port to access the database, you can do so by appending ":portnumber" to the database.hostname variable.
2018-11-25 07:56:02 +01:00
'database' => [
'hostname' => 'your.mysqlhost.com:123456',
]
2018-06-28 05:07:38 +02:00
If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
MYSQL_HOST
MYSQL_PORT
MYSQL_USERNAME
MYSQL_PASSWORD
MYSQL_DATABASE
2018-11-25 07:56:02 +01:00
## Config values that can only be set in config/local.config.php
2018-06-28 05:07:38 +02:00
2016-10-24 17:57:25 +02:00
There are some config values that haven't found their way into the administration page.
This has several reasons.
Maybe they are part of a current development that isn't considered stable and will be added later in the administration page when it is considered safe.
2017-09-24 11:00:16 +02:00
Or it triggers something that isn't expected to be of public interest.
Or it is for testing purposes only.
2015-10-04 12:02:44 +02:00
2016-10-24 17:57:25 +02:00
**Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger.
Especially don't do that with undocumented values.
2015-10-04 12:02:44 +02:00
2019-06-23 19:56:21 +02:00
These configurations keys and their default value are listed in `static/defaults.config.php` and should be overwritten in `config/local.config.php` .
2018-07-17 08:03:39 +02:00
## Administrator Options
2015-10-07 09:38:47 +02:00
2016-10-24 17:57:25 +02:00
Enabling the admin panel for an account, and thus making the account holder admin of the node, is done by setting the variable
2015-10-07 09:38:47 +02:00
2018-11-25 07:56:02 +01:00
'config' => [
'admin_email' => 'someone@example.com',
]
2015-10-07 09:38:47 +02:00
2018-11-25 07:56:02 +01:00
Where you have to match the email address used for the account with the one you enter to the `config/local.config.php` file.
2018-06-28 05:07:38 +02:00
If more then one account should be able to access the admin panel, separate the email addresses with a comma.
2015-10-07 09:38:47 +02:00
2018-11-25 07:56:02 +01:00
'config' => [
'admin_email' => 'someone@example.com,someoneelse@example.com',
]
2015-10-07 09:38:47 +02:00
2018-11-25 07:56:02 +01:00
If you want to have a more personalized closing line for the notification emails you can set a variable for the `admin_name` .
2015-10-07 09:38:47 +02:00
2018-11-25 07:56:02 +01:00
'config' => [
'admin_name' => 'Marvin',
]