|
| 1 | +<!-- |
| 2 | + This source file is part of the open source project |
| 3 | + ExpressionEngine User Guide (https://github.com/ExpressionEngine/ExpressionEngine-User-Guide) |
| 4 | +
|
| 5 | + @link https://expressionengine.com/ |
| 6 | + @copyright Copyright (c) 2003-2022, Packet Tide, LLC (https://packettide.com) |
| 7 | + @license https://expressionengine.com/license Licensed under Apache License, Version 2.0 |
| 8 | +--> |
| 9 | + |
| 10 | +# Main Configuration File |
| 11 | + |
| 12 | +The main configuration settings are stored in the form of a PHP array in the `system/user/config/config.php` file. |
| 13 | + |
| 14 | +This file is populated automatically during the installation process and contains the most important settings that are used by ExpressionEngine. |
| 15 | + |
| 16 | +Settings from this file are loaded every time the system is run. This means that [config overrides](general/system-configuration-overrides.md) set in `config.php` always affect the system’s configuration. |
| 17 | + |
| 18 | +At a minimum, this configuration file contains the following settings: |
| 19 | + |
| 20 | +#### `app_version` |
| 21 | + |
| 22 | +The installation's ExpressionEngine version. This value is set automatically and normally should not be modified. |
| 23 | + |
| 24 | +However if you need to run an update script again, you can modify this value to a lower version number so the system would "see" the update(s) available. |
| 25 | + |
| 26 | + $config['app_version'] = '7.4.0'; |
| 27 | + |
| 28 | +#### `encryption_key` |
| 29 | + |
| 30 | +This is the secret key used by the [Encrypt service](development/services/encrypt.md) to protect sensitive data in the database. It is set automatically during the installation process. If you need to use your own key please refer to [Troubleshooting guide](troubleshooting/error-messages.md#generating-new-encryption-keys) on how to generate a new one. |
| 31 | + |
| 32 | + $config['encryption_key'] = '26791dcd5c7cc9e569cc05b16b96235985cc9f03'; |
| 33 | + |
| 34 | +#### `session_crypt_key` |
| 35 | + |
| 36 | +Similar to the `encryption_key`, but used to protected session data. |
| 37 | + |
| 38 | + $config['session_crypt_key'] = 'd9e776dc9a5de0cd83e7c76a76756daa64ff4b8b'; |
| 39 | + |
| 40 | +#### `database` |
| 41 | + |
| 42 | +The database connection details are one of the most important settings in the configuration file. The array is required to have an element with a key of `expressionengine`, which in turn needs to be an array with the following keys: |
| 43 | + |
| 44 | + - `hostname` - The hostname or IP address of your database server |
| 45 | + - `database` - The name of the database to connect to |
| 46 | + - `username` - The username used to connect to the database |
| 47 | + - `password` - The password used to connect to the database |
| 48 | + - `dbprefix` - The prefix used for all database tables (default is `exp_`) |
| 49 | + - `char_set` - The character set used in communicating with the database (default is `utf8mb4`) |
| 50 | + - `dbcollat` - The character collation used in communicating with the database (default is `utf8mb4_unicode_ci`) |
| 51 | + - `port` - The port used to connect to the database (default is `3306`) |
| 52 | + |
| 53 | + ```php |
| 54 | + $config['database'] = array( |
| 55 | + 'expressionengine' => array( |
| 56 | + 'hostname' => 'localhost', |
| 57 | + 'database' => 'ee740', |
| 58 | + 'username' => 'root', |
| 59 | + 'password' => '', |
| 60 | + 'dbprefix' => 'exp_', |
| 61 | + 'char_set' => 'utf8mb4', |
| 62 | + 'dbcollat' => 'utf8mb4_unicode_ci', |
| 63 | + 'port' => '' |
| 64 | + ), |
| 65 | + ); |
| 66 | + ``` |
| 67 | + |
| 68 | +In addition, you can use following keys inside `expressionengine`: |
| 69 | + |
| 70 | + - `pconnect` - Whether to use persistent connections (default is `true`) |
| 71 | + |
| 72 | +The following keys can be specified and will be converted to [PDO constants](https://www.php.net/manual/en/ref.pdo-mysql.php#pdo-mysql.constants) when passed to the database driver: |
| 73 | + |
| 74 | + - `MYSQL_ATTR_LOCAL_INFILE` |
| 75 | + - `MYSQL_ATTR_LOCAL_INFILE_DIRECTORY` |
| 76 | + - `MYSQL_ATTR_READ_DEFAULT_FILE` |
| 77 | + - `MYSQL_ATTR_READ_DEFAULT_GROUP` |
| 78 | + - `MYSQL_ATTR_MAX_BUFFER_SIZE` |
| 79 | + - `MYSQL_ATTR_INIT_COMMAND` |
| 80 | + - `MYSQL_ATTR_COMPRESS` |
| 81 | + - `MYSQL_ATTR_SSL_CA` |
| 82 | + - `MYSQL_ATTR_SSL_CAPATH` |
| 83 | + - `MYSQL_ATTR_SSL_CERT` |
| 84 | + - `MYSQL_ATTR_SSL_CIPHER` |
| 85 | + - `MYSQL_ATTR_SSL_KEY` |
| 86 | + - `MYSQL_ATTR_SSL_VERIFY_SERVER_CERT` |
0 commit comments