Install phpBB 3.3 with Apache on Ubuntu 26.04 LTS
Set up a phpBB 3.3 forum on Ubuntu 26.04 LTS with Apache, MariaDB and PHP, including HTTPS and post-install hardening, with notes for Ubuntu 24.04 and Debian.
By the end of this guide you will have a phpBB 3.3 forum served by Apache with a MariaDB database on Ubuntu 26.04 LTS, with notes for Ubuntu 24.04 LTS and Debian 13. Older tutorials on this topic used Ubuntu 16.04, PHP 7.0 and phpBB 3.2, all of which are long out of support. The steps are the same idea, but the package names, the PHP version and the phpBB installer have changed.
Requirements and a note on PHP versions
You need a server with a user that can run sudo (the examples use deploy) and a DNS name pointing at it, here forum.example.com.
The current stable phpBB branch is 3.3; this guide uses 3.3.19. Its installation notes ask for:
- PHP 7.2.0 or newer with the
json,mbstringand XML modules, plus the driver for your database. GD and zlib are optional but useful. - MySQL 4.1.3 or newer, MariaDB 5.1 or newer, PostgreSQL 8.3 or newer, or SQLite 3.6.15 or newer.
Pay attention to the upper PHP limit. The INSTALL document shipped with 3.3.19 says "up to and including PHP 8.3", while the README in the same package says the latest stable PHP is supported. The distributions ship these versions:
| System | Default PHP | Default MariaDB |
|---|---|---|
| Ubuntu 26.04 LTS | 8.5 | 11.8 |
| Ubuntu 24.04 LTS | 8.3 | 10.11 |
| Debian 13 | 8.4 | 11.8 |
| Debian 12 | 8.2 | 10.11 |
Ubuntu 24.04 and Debian 12 sit inside the documented range. On Ubuntu 26.04 and Debian 13 you are running a newer PHP than the install notes list, so test the board and any extensions before you move a live community onto it. The commands below are identical on all four systems because the unversioned php-* packages follow the distribution default.
Step 1: Install Apache, MariaDB and PHP
sudo apt update
sudo apt install -y apache2 mariadb-server php libapache2-mod-php php-mysql php-mbstring php-xml php-gd unzip
JSON support is built into PHP 8, so there is no separate package for it, and the old mcrypt extension is no longer needed. Confirm the version you got:
php -v
Step 2: Create the database
Harden the fresh MariaDB installation, answering yes to removing anonymous users, the test database and remote root login:
sudo mariadb-secure-installation
Open a MariaDB shell as root. On Ubuntu and Debian the root account authenticates through the system socket, so no password is needed with sudo:
sudo mariadb
Create a database and a user that can only access it. Pick your own password:
CREATE DATABASE phpbb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'phpbb'@'localhost' IDENTIFIED BY 'choose-a-strong-password';
GRANT ALL PRIVILEGES ON phpbb.* TO 'phpbb'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 3: Download and unpack phpBB
Download the release archive and its checksum file, and verify the download before unpacking it. Check the phpBB downloads page for a newer 3.3 release and adjust the version in the URLs if there is one.
cd /tmp
wget https://download.phpbb.com/pub/release/3.3/3.3.19/phpBB-3.3.19.zip
wget https://download.phpbb.com/pub/release/3.3/3.3.19/phpBB-3.3.19.zip.sha256
sha256sum -c phpBB-3.3.19.zip.sha256
The last command must print phpBB-3.3.19.zip: OK. Unpack the archive, which contains a phpBB3 directory, and move it into place:
unzip -q phpBB-3.3.19.zip
sudo mv phpBB3 /var/www/phpbb
phpBB only needs to write to its configuration file and four directories. Keep everything else owned by root so a compromised script cannot rewrite the code:
cd /var/www/phpbb
sudo chown -R root:root .
sudo chown -R www-data:www-data config.php store cache files images/avatars/upload
Step 4: Configure the Apache virtual host
Create /etc/apache2/sites-available/phpbb.conf:
<VirtualHost *:80>
ServerName forum.example.com
DocumentRoot /var/www/phpbb
<Directory /var/www/phpbb>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/phpbb_error.log
CustomLog ${APACHE_LOG_DIR}/phpbb_access.log combined
</VirtualHost>
AllowOverride All matters: phpBB ships .htaccess files that block web access to sensitive directories such as cache/, files/, store/ and vendor/. Enable the site and the rewrite module, disable the default site and reload Apache:
sudo a2ensite phpbb
sudo a2dissite 000-default
sudo a2enmod rewrite
sudo apache2ctl configtest
sudo systemctl reload apache2
If the UFW firewall is active, allow web traffic:
sudo ufw allow 'Apache Full'
Step 5: Add HTTPS
Forum logins should not travel over plain HTTP. With the DNS record in place, request a certificate with Certbot's Apache plugin, which also configures the redirect to HTTPS:
sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d forum.example.com
Step 6: Run the web installer
Open https://forum.example.com/install/ and choose the Install tab. The installer checks the PHP requirements and then asks for:
- the administrator user name, password and email address;
- the database: type MySQL with MySQLi Extension, host
localhost, databasephpbb, userphpbband the password from step 2 (leave the port empty); - server settings, where you should confirm that the protocol is
https://and the domain is correct; - email and board settings, which you can change later.
Step 7: Lock down the installation
When the installer reports success, remove the install directory and take write access to the configuration file away from the web server. phpBB keeps the board disabled for normal users until the installer directory is gone.
sudo rm -rf /var/www/phpbb/install
sudo chown root:root /var/www/phpbb/config.php
sudo chmod 644 /var/www/phpbb/config.php
Log in, open the Administration Control Panel from the link at the bottom of the page and review the settings on the General tab.
Maintenance and troubleshooting
- Backups: dump the database with
sudo mariadb-dump phpbb > phpbb.sqland copyconfig.php,files/,store/andimages/avatars/upload/. - Updating phpBB: minor 3.3 releases are applied by uploading the new files and running the database updater under
/install/; follow the update section of the bundled documentation for the release you are moving to, and back up first. - System updates:
sudo apt update && sudo apt upgradekeeps Apache, PHP and MariaDB patched. - Blank page or HTTP 500: read
/var/log/apache2/phpbb_error.log. A missing PHP module or a non-writablecache/directory are the usual causes. - Deprecation notices on PHP 8.4 or 8.5: see the version note above. Clearing the
cache/directory after changing PHP versions avoids stale compiled templates.
Frequently asked questions
Should I install phpBB 4 instead?
Not for a live forum. phpBB 4.0 exists only as alpha releases at the time of writing; 3.3 is the stable, supported branch.
Can I use Nginx or PostgreSQL instead of Apache and MariaDB?
Yes. phpBB supports PostgreSQL 8.3 and newer, and it runs behind Nginx with PHP-FPM. With Nginx the bundled .htaccess files have no effect, so you must add your own rules denying access to cache/, files/, store/, includes/, phpbb/ and vendor/.
Why not unpack phpBB straight into /var/www/html as older guides did?
A dedicated directory and virtual host keep the forum separate from the default site, let you host other sites on the same server, and avoid leaving the downloaded archive inside the web root.
Is the phpbb3 package from the distribution an option?
No. Debian 12 and 13 and current Ubuntu releases do not carry a phpBB package (Ubuntu last shipped one in 16.04, and that was phpBB 3.0), so the upstream archive is the way to install it.