So, you discovered Discourse and want to know how to migrate from your existing phpBB3 forum?
Great! Then keep on reading. This guide will show you how to use the phpBB3 import script for importing from phpBB 3.0 up to 3.3.
- Avatars (optional)
- Anonymous users (either as user “system” or as suspended users)
- Password hashes, which can be used with the migratepassword plugin (optional)
- User profile data (birth date, website, location, custom fields, etc.)
- Categories and Forums
- Topics and Posts
- Polls and votes (optional)
- Internal links to topics and posts
- Sticky topics and (global) announcements
- Private Messages (optional)
- Attachments (optional)
- Bookmarks (optional)
- Permalinks for imported categories, topics and posts (optional)
This is the recommended way for importing content from your phpBB3 forum into Discourse.
Install Discourse by following the official installation guide.
Afterwards it’s a good idea to go to the Admin section and configure a few settings:
login_requiredif imported topics shouldn’t be visible to the public
hide_user_profiles_from_publicif user profiles shouldn’t be visible to the public.
download_remote_images_to_localif you don’t want Discourse to download images embedded in posts.
disable_edit_notificationsif you enabled
download_remote_images_to_localand don’t want your users to get lots of notifications about posts edited by the system user.
- Change the value of
slug_generation_methodif most of the topic titles use characters which shouldn’t be mapped to ASCII (e.g. Arabic). See this post for more information.
The following steps assume that you installed Discourse on Ubuntu and that you are connected to the machine via SSH or have direct access to the machine’s terminal.
Copy the container configuration file
import.yml and edit it with your favorite editor.
cd /var/discourse cp containers/app.yml containers/import.yml nano containers/import.yml
- "templates/import/phpbb3.template.yml" to the list of templates. Afterwards it should look something like this:
templates: - "templates/postgres.template.yml" - "templates/redis.template.yml" - "templates/web.template.yml" - "templates/web.ratelimited.template.yml" ## Uncomment these two lines if you wish to add Lets Encrypt (https) #- "templates/web.ssl.template.yml" #- "templates/web.letsencrypt.ssl.template.yml" - "templates/import/phpbb3.template.yml"
That’s it. You can save the file, close the editor and build the container.
/var/discourse/launcher stop app /var/discourse/launcher rebuild import
Building the container creates an
import directory within the container’s shared directory. It looks like this:
/var/discourse/shared/standalone/import ├── data ├── mysql └── settings.yml
You can configure the importer by editing the example
settings.yml file that has been copied into the
The settings file is well documented and comes with sensible defaults, but here are a few tips anyway:
Change the database
schema if you want to connect to a remote database. Make sure that your MySQL server allows remote connections.
The Docker container comes with a MariaDB server which is compatible with MySQL. You don’t need to change any database settings if you are going to use it. All you need is a database dump which you can create in multiple ways. Here are two of them:
Create a database backup in phpBB’s Administration Control Panel
Connect to the database host and create a database dump:
# replace the last parameter "phpbb" with the database schema name mysqldump --user root --password --result-file phpbb_mysql.sql phpbb
Copy the database dump into the
/var/discourse/shared/standalone/import/data/ directory. You need to extract the file if you created a gzip or bzip2 compressed backup and make sure that the file is named
- Change the
table_prefixin case your phpBB forum isn’t using the default naming for database tables.
- Make sure the
You can skip this step if you don’t want to import attachments, avatars or smilies.
Connect to your phpBB3 host using FTP or SCP and download the following directories into the
Attachments are usually stored in the
filesdirectory. You can make sure by checking the path in the Administration Control Panel.
Avatars are usually stored in the
images/avatarsdirectory. You can make sure by checking the path in the Administration Control Panel.
Smilies are stored in the
import directory should look like this if you downloaded all of those directories:
/var/discourse/shared/standalone/import ├── data │ ├── files │ ├── images │ │ ├── avatars │ │ │ ├── gallery │ │ │ └── upload │ │ └── smilies ├── mysql └── settings.yml
Let’s start the import by entering the Docker container and launching the import script inside the Docker container.
/var/discourse/launcher enter import import_phpbb3.sh # inside the Docker container
Depending on the size of your forum it’s now time for some or
The import script will show you a message like this when it’s finished: Done (00h 26min 52sec)
And while you are waiting for the import to finish you can take a look at the FAQ.
Tip: You can abort the import anytime you want by pressing Ctrl+C
When you restart the import it will continue where it left off.
You can exit and stop the Docker container after the import has finished.
exit # inside the Docker container /var/discourse/launcher stop import
Let’s start the app container and take a look at the imported data.
/var/discourse/launcher start app
Discourse will start and Sidekiq will begin post-processing all the imported posts. This can take a considerate amount of time. You can watch the progress by logging in as admin and visiting
So, you are satisfied with the result of the import and want to free some disk space? The following commands will delete the Docker container used for importing as well as all the files used during the import.
/var/discourse/launcher destroy import rm /var/discourse/containers/import.yml rm -R /var/discourse/shared/standalone/import
Now it’s time to celebrate and enjoy your new Discourse instance!
The following instructions are for users who want to import using a development environment.
Make sure that neither Discourse nor Sidekiq are running.
Install some dependencies:
sudo apt-get update sudo apt-get install libmysqlclient-dev cd ~/discourse IMPORT=1 bundle install git checkout Gemfile Gemfile.lock
Configure your import. There’s an example settings file at
Start your import (change the path to your settings file if you put your custom settings somewhere else):
cd ~/discourse/script/import_scripts IMPORT=1 bundle exec ruby phpbb3.rb phpbb3/settings.yml
Wait until the import is done. You can restart it if it slows down to a crawl.
Start your Discourse instance:
cd ~/discourse bundle exec rails server bin/ember-cli
Start Sidekiq and let it do its work:
bundle exec sidekiq
Depending on your forum size this can take a long time. You can monitor the progress at
Here’s a list of things that are still missing from the importer (in no particular order) :
- Add support for the cakeday plugin
- Imported text that looks like Markdown should be escaped
- Close topics that are closed in phpBB3
- Import unapproved posts as hidden posts
- Import read status for each post and private message
- Improve the BBCode to Markdown converter (ruby-bbcode-to-md)
- Support custom patterns for internal links to topics and posts (SEO optimized URLs)
- Add support for more database sources: MS SQL Server, Oracle, PostgreSQL
Feel free to start your favorite Ruby IDE and help making the importer even better.
Maybe. It depends on what changes those mods made to the database. You’ll have to give it a try.
Importing is CPU-bound. You should use CPUs with fast single-core speed if you are in a hurry. You get an import speed of about 400–600 posts/minute on a typical DigitalOcean server. Bare metal servers, and probably also your desktop computer, are usually about twice as fast.
4.3. I have a large forum with lots of users and posts. How can I minimize the downtime during the import?
You can do incremental imports in order to shorten the downtime.
But be warned: There’s a small risk of data loss when you do an incremental import, because existing posts and users aren’t updated during incremental imports. You’ll lose post edits that occurred between imports as well as changes made to user profiles.
Of course. You can move your Discourse instance to a different server after the import has finished. Take a look at this How-To for instructions.
Sending of emails is disabled during the import and Discourse holds off on sending summary emails to imported users for some time. This can be configured with the site setting
default_email_digest_frequency which defaults to 7 days.
It is recommended to always use the
beta channel of Discourse for imports since the import script is being constantly improved. So, make sure that the value of
version is set accordingly in the
import.yml configuration files. Everything should be fine if you followed the official installation guide.
Make sure that you enabled the migratepassword plugin in
app.yml by following the How-To for installing plugins. Also, users won’t be able to login with their old password if it’s considered insecure. By default Discourse requires a minimum password length of 10 chars (for admins it’s 15) and the password must not be on the list of common passwords. But users can always reset their password by clicking the “I forgot my password” link on the login dialog or directly by visiting
The list of users won’t show up right away. It is generated by a background task which is executed by Sidekiq. You’ll probably have to wait until all the post-processing of the imported data is finished.
Yes. You can map them to Emojis in the settings file, otherwise they’ll get imported as images. All the default smilies (except and ) already have an Emoji mapping.
Last Reviewed by @cocococosti on 2022-07-22T04:00:00Z