Flarum is a free, open-source PHP forum platform, installed primarily through Composer, PHP’s dependency management tool. The process involves setting up a server environment with the correct PHP version and extensions, installing Composer, creating a database, then running a single Composer command to download and configure Flarum before finishing setup through a web-based installer. Here’s the full process, covering both server setup and the installation itself.
Check Your Server Requirements First
Before installing, confirm your server meets Flarum’s requirements. You’ll need:
- PHP 7.3 or higher, with the following extensions enabled: curl, dom, fileinfo, gd, json, mbstring, openssl, pdo_mysql, tokenizer, and zip
- A MySQL or MariaDB database
- Composer, PHP’s dependency manager, required to install and manage Flarum and its extensions
- SSH (command-line) access to your server, needed to run installation and maintenance commands
- Apache or Nginx with mod_rewrite (or equivalent URL rewriting) enabled, since Flarum relies on a
.htaccess file for proper routing on Apache
Flarum’s 1.x branch supports PHP versions up through 8.5, though it’s built on an older framework stack. If you’re installing the newer Flarum 2.0 (currently in release candidate stages), note that it requires PHP 8.3 or higher specifically.
Step 1: Install PHP and Required Extensions
On a fresh Ubuntu server, install PHP along with Flarum’s required extensions:
sudo apt update
sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
sudo apt install php8.2 php8.2-{bcmath,xml,fpm,mysql,zip,intl,ldap,gd,cli,bz2,curl,mbstring,pgsql,opcache,soap,cgi} -y
Verify your installed version:
php -v
Step 2: Configure PHP Settings
Flarum needs specific PHP configuration values to run smoothly. Edit your php.ini file and set:
memory_limit = 256M
max_execution_time = 300
upload_max_filesize = 150M
allow_url_fopen = On
file_uploads = On
Step 3: Install Composer
Composer is required to download and manage Flarum itself. On most shared hosting environments, Composer is often pre-installed — check with your host before installing manually. On a self-managed server, install it via your package manager or Composer’s official installer script.
Step 4: Set Up Your Web Server and Database
Install and configure a LAMP-style stack if you haven’t already:
sudo apt install apache2 mariadb-server git -y
Then create a dedicated database and database user for Flarum through MySQL/MariaDB (or through your hosting control panel’s database manager, if using shared hosting):
CREATE DATABASE flarum;
CREATE USER 'flarumuser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON flarum.* TO 'flarumuser'@'localhost';
FLUSH PRIVILEGES;
Make note of the database name, username, and password — you’ll need them during the web-based setup step.
Step 5: Install Flarum via Composer
Navigate to the empty directory where you want Flarum installed, then run:
composer create-project flarum/flarum . --stability=beta
This single command handles two things: it downloads a boilerplate “skeleton” containing the index.php file that handles web requests, the flarum CLI file, and web server configuration, and it installs Flarum core along with its dependencies through Composer’s package management system.
Step 6: Configure Your Web Server to Point to Flarum
Set your Apache or Nginx virtual host document root to the public directory inside your Flarum installation folder, not the root of the installation itself. Enable .htaccess overrides if using Apache — Flarum will not function correctly if mod_rewrite is disabled or .htaccess files aren’t permitted, so confirm this setting with your hosting provider or in your own server configuration if self-managed.
Step 7: Complete the Web-Based Setup
Once your server and database are ready, navigate to your forum’s URL in a web browser. Flarum’s installer will guide you through the remaining steps:
- Confirm your server meets all requirements (the installer checks this automatically).
- Enter your database connection details — hostname, database name, username, and password.
- Create your forum’s administrator account.
- Set your forum’s title and base URL.
- Complete the installation and log in to your new forum.
Step 8: Secure Your Forum With SSL (Recommended)
Once Flarum is running, securing it with HTTPS is strongly recommended, especially for any forum handling user accounts and logins. Let’s Encrypt provides free SSL certificates and can typically be configured with a tool like Certbot on a self-managed server, or enabled directly through your hosting control panel on shared hosting.
Installing Extensions
Flarum’s core is intentionally minimal, with most additional functionality — tags, likes, mentions, and more — added through extensions installed via Composer. From your Flarum installation directory, extensions are typically added with:
composer require vendor/extension-name
Alternatively, if you install Flarum’s official Extension Manager extension, admins can install and manage extensions directly from the web-based admin dashboard rather than the command line. Only enable this if you trust everyone with admin access, since the Extension Manager allows installing any Composer package directly through the forum’s interface.
Join The Discussion
Flarum’s Composer-based setup is more developer-oriented than some plug-and-play forum platforms, which can trip up first-time self-hosters. Have you set up a Flarum forum before, either on shared hosting or a self-managed server? Share any gotchas you ran into during setup, favorite extensions you’d recommend, or questions about getting your own installation running.