Skip to main content
Version: 2.x

Configuration File

There is only one place where Flarum configuration cannot be modified through the Flarum admin dashboard (excluding the database), and that is the config.php file located in the root of your Flarum installation.

This file, though small, contains details that are crucial for your Flarum installation to work.

If the file exists, it tells Flarum that it has already been installed. It also provides Flarum with database info and more.

Here's a quick overview of what everything means with an example file:

<?php return array (
'debug' => false, // enables or disables debug mode, used to troubleshoot issues
'offline' => false, // none, high, low or safe.
'database' =>
array (
'driver' => 'mysql', // the database driver, i.e. MySQL, MariaDB, PostgreSQL, SQLite
'host' => 'localhost', // the host of the connection, localhost in most cases unless using an external service
'database' => 'flarum', // the name of the database in the instance
'username' => 'root', // database username
'password' => '', // database password
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '', // the prefix for the tables, useful if you are sharing the same database with another service
'port' => '3306', // the port of the connection, defaults to 3306 with MySQL
'strict' => false,
),
'url' => 'https://flarum.localhost', // the URL installation, you will want to change this if you change domains
'paths' =>
array (
'api' => 'api', // /api goes to the API
'admin' => 'admin', // /admin goes to the admin
),
);

Maintenance modes

Flarum has a maintenance mode that can be enabled by setting the offline key in the config.php file to one of the following values:

  • none - No maintenance mode.
  • high - No one can access the forum, not even admins.
  • low - Only admins can access the forum.
  • safe - Only admins can access the forum, and no extensions are booted.

This can also be configured from the admin panel's advanced settings page:

Toggle advanced page