]> git.mxchange.org Git - friendica.git/blob - doc/Config.md
ba6e674fc63d424b17068005378e5465eeb3710a
[friendica.git] / doc / Config.md
1 Config values that can only be set in config/local.ini.php
2 ==========================================================
3
4 * [Home](help)
5
6 Friendica's configuration is done in two places: in INI configuration files and in the `config` database table.
7 Database config values overwrite the same file config values.
8
9 ## File configuration
10
11 The configuration format for file configuration is an INI string returned from a PHP file.
12 This prevents your webserver from displaying your private configuration it interprets the configuration files and displays nothing.
13
14 A typical configuration file looks like this:
15
16 ```php
17 <?php return <<<INI
18
19 ; Comment line
20
21 [section1]
22 key = value
23 empty_key =
24
25 [section2]
26 array[] = value0
27 array[] = value1
28 array[] = value2
29
30 INI;
31 // Keep this line
32 ```
33
34 ### Configuration location
35
36 The `config` directory holds key configuration files:
37
38 - `config.ini.php` holds the default values for all the configuration keys that can only be set in `local.ini.php`.
39 - `settings.ini.php` holds the default values for some configuration keys that are set through the admin settings page.
40 - `local.ini.php` holds the current node custom configuration.
41 - `addon.ini.php` is optional and holds the custom configuration for specific addons.
42
43 Addons can define their own default configuration values in `addon/[addon]/config/[addon].ini.php` which is loaded when the addon is activated.
44
45 #### Migrating from .htconfig.php to config/local.ini.php
46
47 The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
48
49 The migration is pretty straightforward:
50 If you had any addon-specific configuration in your `.htconfig.php`, just copy `config/addon-sample.ini.php` to `config/addon.ini.php` and move your configuration values.
51 Afterwards, copy `config/local-sample.ini.php` to `config/local.ini.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.
52
53 <style>
54 table.config {
55     margin: 1em 0;
56     background-color: #f9f9f9;
57     border: 1px solid #aaa;
58     border-collapse: collapse;
59     color: #000;
60     width: 100%;
61 }
62
63 table.config > tr > th,
64 table.config > tr > td,
65 table.config > * > tr > th,
66 table.config > * > tr > td {
67     border: 1px solid #aaa;
68     padding: 0.2em 0.4em
69 }
70
71 table.config > tr > th,
72 table.config > * > tr > th {
73     background-color: #f2f2f2;
74     text-align: center;
75     width: 50%
76 }
77 </style>
78
79 <table class="config">
80         <thead>
81                 <tr>
82                         <th>.htconfig.php</th>
83                         <th>config/local.ini.php</th>
84                 </tr>
85         </thead>
86         <tbody>
87                 <tr>
88                         <td><pre>
89 $db_host = 'localhost';
90 $db_user = 'mysqlusername';
91 $db_pass = 'mysqlpassword';
92 $db_data = 'mysqldatabasename';
93 $a->config["system"]["db_charset"] = 'utf8mb4';
94 </pre></td>
95                         <td><pre>
96 [database]
97 hostname = localhost
98 username = mysqlusername
99 password = mysqlpassword
100 database = mysqldatabasename
101 charset = utf8mb4
102 </pre></td>
103                 </tr>
104
105                 <tr>
106                         <td><pre>
107 $a->config["section"]["key"] = "value";
108 </pre></td>
109                         <td><pre>
110 [section]
111 key = value
112 </pre></td>
113                 </tr>
114
115                 <tr>
116                         <td><pre>
117 $a->config["section"]["key"] = array(
118         "value1",
119         "value2",
120         "value3"
121 );
122 </pre></td>
123                         <td><pre>
124 [section]
125 key[] = value1
126 key[] = value2
127 key[] = value3
128 </pre></td>
129                 </tr>
130
131                 <tr>
132                         <td><pre>
133 $a->config["key"] = "value";
134 </pre></td>
135                         <td><pre>
136 [config]
137 key = value
138 </pre></td>
139                 </tr>
140
141                 <tr>
142                         <td><pre>
143 $a->path = "value";
144 </pre></td>
145                         <td><pre>
146 [system]
147 urlpath = value
148 </pre></td>
149                 </tr>
150
151                 <tr>
152                         <td><pre>
153 $default_timezone = "value";
154 </pre></td>
155                         <td><pre>
156 [system]
157 default_timezone = value
158 </pre></td>
159                 </tr>
160
161                 <tr>
162                         <td><pre>
163 $pidfile = "value";
164 </pre></td>
165                         <td><pre>
166 [system]
167 pidfile = value
168 </pre></td>
169                 </tr>
170
171                 <tr>
172                         <td><pre>
173 $lang = "value";
174 </pre></td>
175                         <td><pre>
176 [system]
177 language = value
178 </pre></td>
179                 </tr>
180
181         </tbody>
182 </table>
183
184
185 ### Database Settings
186
187 The configuration variables database.hostname, database.username, database.password, database.database and database.charset are holding your credentials for the database connection.
188 If you need to specify a port to access the database, you can do so by appending ":portnumber" to the database.hostname variable.
189
190     [database]
191     hostname = your.mysqlhost.com:123456
192
193 If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
194
195     MYSQL_HOST
196     MYSQL_PORT
197     MYSQL_USERNAME
198     MYSQL_PASSWORD
199     MYSQL_DATABASE
200
201 ## Config values that can only be set in config/local.ini.php
202
203 There are some config values that haven't found their way into the administration page.
204 This has several reasons.
205 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.
206 Or it triggers something that isn't expected to be of public interest.
207 Or it is for testing purposes only.
208
209 **Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger.
210 Especially don't do that with undocumented values.
211
212 These configurations keys and their default value are listed in `config/config.ini.php` and should be ovewritten in `config/local.ini.php`.
213
214 ## Administrator Options
215
216 Enabling the admin panel for an account, and thus making the account holder admin of the node, is done by setting the variable
217
218     [config]
219     admin_email = someone@example.com
220
221 Where you have to match the email address used for the account with the one you enter to the config/local.ini.php file.
222 If more then one account should be able to access the admin panel, separate the email addresses with a comma.
223
224     [config]
225     admin_email = someone@example.com,someoneelse@example.com
226
227 If you want to have a more personalized closing line for the notification emails you can set a variable for the admin_name.
228
229     [config]
230     admin_name = Marvin