Friendica's configuration is done in two places: in INI 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 INI string 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
<?php return <<<INI
; Comment line
[section1]
key = value
empty_key =
[section2]
array[] = value0
array[] = value1
array[] = value2
INI;
// Keep this line
```
## Configuration location
All the configuration keys Friendica uses are listed with their default value if any in `config/defaults.ini.php`.
Addons can define their own default configuration values in `addon/[addon]/config/[addon].ini.php` which are loaded when the addon is activated.
### Migrating from .htconfig.php to config/local.ini.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, just copy `config/local-sample.ini.php` to `config/local.ini.php`, add your 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.
<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>
<tableclass="config">
<thead>
<tr>
<th>.htconfig.php</th>
<th>config/local.ini.php</th>
</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>
[database]
hostname = localhost
username = mysqlusername
password = mysqlpassword
database = mysqldatabasename
charset = utf8mb4
</pre></td>
</tr>
<tr>
<td><pre>
$a->config["section"]["key"] = "value";
</pre></td>
<td><pre>
[section]
key = value
</pre></td>
</tr>
<tr>
<td><pre>
$a->config["section"]["key"] = array(
"value1",
"value2",
"value3"
);
</pre></td>
<td><pre>
[section]
key[] = value1
key[] = value2
key[] = value3
</pre></td>
</tr>
<tr>
<td><pre>
$a->config["key"] = "value";
</pre></td>
<td><pre>
[config]
key = value
</pre></td>
</tr>
<tr>
<td><pre>
$a->path = "value";
</pre></td>
<td><pre>
[system]
urlpath = value
</pre></td>
</tr>
<tr>
<td><pre>
$default_timezone = "value";
</pre></td>
<td><pre>
[system]
default_timezone = value
</pre></td>
</tr>
<tr>
<td><pre>
$pidfile = "value";
</pre></td>
<td><pre>
[system]
pidfile = value
</pre></td>
</tr>
<tr>
<td><pre>
$lang = "value";
</pre></td>
<td><pre>
No equivalent (yet)
</pre></td>
</tr>
</tbody>
</table>
## Database Settings
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.
[database]
hostname = your.mysqlhost.com:123456
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
# Config values that can only be set in config/local.ini.php
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.
* **auth_cookie_lifetime** (Integer) - Number of days that should pass without any activity before a user who chose "Remember me" when logging in is considered logged out. Defaults to 7.
* **config_adapter** (jit|preload) - Allow to switch the configuration adapter to improve performances at the cost of memory consumption. Default value is "jit"
* **dbclean_expire_conversation** (Integer) - When DBClean is enabled, any entry in the conversation table will be deleted after this many days. These data are normally needed only for debugging purposes and they are safe to delete. Default 90.
* **disable_password_exposed** (Boolean) - Disable the exposition check against the remote haveibeenpwned API on password change. Default value is false.
* **groupedit_image_limit** (Integer) - Number of contacts at which the group editor should switch from display the profile pictures of the contacts to only display the names. Default is 400. This can alternatively be set on a per account basis in the pconfig table.
* **instances_social_key** - Key to the API of https://instances.social which retrieves data about mastodon servers. See https://instances.social/api/token to get an API key.
* **invitation_only** (Boolean) - If set true registration is only possible after a current member of the node has send an invitation. Default is false.
* **max_connections** - The maximum number of database connections which can be in use before the worker process is deferred to it's next interval. When the system can't detect the maximum numbers of connection then this value can be used.
* **max_connections_level** - The maximum level of connections that are allowed to let the worker start. It is a percentage value. Default value is 75.
* **session_handler** (database|cache|native) - Whether to use Cache to store session data or to use PHP native session storage. Default value is `database`.
* **cache_driver** (database|memcache|memcached) - Whether to use Memcache or Memcached to store temporary cache. Default value is `database`.
* **profiler** (Boolean) - Enable internal timings to help optimize code. Needed for "rendertime" addon. Default is false.
* **free_crawls** - Number of "free" searches when "permit_crawling" is activated (Default value is 10)
* **crawl_permit_period** - Period in seconds between allowed searches when the number of free searches is reached and "permit_crawling" is activated (Default value is 60)
* **png_quality** - Default value is 8.
* **proc_windows** (Boolean) - Should be enabled if Friendica is running under Windows.
* **proxy_cache_time** - Time after which the cache is cleared. Default value is one day.
* **pushpoll_frequency** -
* **qsearch_limit** - Default value is 100.
* **remove_multiplicated_lines** (Boolean) - If enabled, multiple linefeeds in items are stripped to a single one.
* **sendmail_params** (Boolean) - Normal sendmail command parameters will be added when the PHP mail() function is called for sending e-mails. This ensures the Sender Email address setting is applied to the message envelope rather than the host's default address. Default is true. Set to false if your non-sendmail agent is incompatible, or to restore old behavior of using the host address.
* **show_global_community_hint** (Boolean) - When the global community page is enabled, use this option to display a hint above the stream, that this is a collection of all public top-level postings that arrive on your node.
* **worker_load_exponent** (Integer) - Default 3, which allows only 25% of the maximum worker queues when server load reaches around 37% of maximum load. For a linear response where 25% of worker queues are allowed at 75% of maximum load, set this to 1. Setting 0 would allow maximum worker queues at all times, which is not recommended.