# Migrate a phpBB3 forum to Discourse

**URL:** https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810
**Category:** Migrating to Discourse
**Tags:** how-to
**Created:** [July 5, 2015, 10:02pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810 "2015-07-05T22:02:57Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 4, 2018, 10:41pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/334 "2018-04-04T22:41:22Z")

</div>

Hey, @allu, are you doing a phpBB3 3.2 import?

@funtent and @MJ94: The Blender community did a [kickstarter](https://www.kickstarter.com/projects/1072051946/blenderartists-20-were-moving-to-discourse) to raise funds to pay for an import as well as significant improvements to the Vbulletin importer.

Perhaps one or both of your communities could do the same.

---

<div class="post-metadata">

### Author: ![allu](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@allu](https://meta.discourse.org/u/allu)
#### Post date: [April 7, 2018, 8:14am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/335 "2018-04-07T08:14:20Z")

</div>

> [@pfaffman](#):
>
> Hey, @allu, are you doing a phpBB3 3.2 import?

Luckily not 😀 The migration I am working on is a old clunky phpBB 3.0.X. Am currently analyzing which bbcode use cases I have in the data, how many of each, and doing some sample visual checks to see if any conversion issues remain. Btw, using this approach to find posts containing a specific bbcode as candidates for my checks (in mysql, for example):

`select * from `phbb\_posts` where post_text REGEXP "\\[size=.*\\]"`

Found this quite helpful for finding the needle(s) in the haystack 😉

---

<div class="post-metadata">

### Author: ![npgatech](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@npgatech](https://meta.discourse.org/u/npgatech)
#### Post date: [May 7, 2018, 1:04am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/336 "2018-05-07T01:04:20Z")

</div>

Hello everyone. We are currently running phpBB 3.2 - I’d love to know how I can help writing the XML to Markdown conversion script.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 7, 2018, 1:21pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/337 "2018-05-07T13:21:43Z")

</div>

The code is there. You’d want to use Nokogiri to help with the transition. There may be other xml to markdown tools.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 24, 2018, 9:08am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/339 "2018-05-24T09:08:49Z")

</div>

Hi,  
I imported a forum but it seems to be an issue regarding the number of topics in the category list:

 ![image](https://global.discourse-cdn.com/meta/original/3X/1/4/1452aac09c422d00bf9b58840a48837ae2922637.png)

And if I go to Général:

 ![image](https://global.discourse-cdn.com/meta/original/3X/7/c/7cc32ea1bfeb78b7c0213595cdb80a38830c2c44.png)

There are hundreds of topics on each category.

However, the number of topics is displated right on the category page:

 ![image](https://global.discourse-cdn.com/meta/original/3X/3/0/3065f011c08447c291d39161200147590f04d94e.png)

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [May 24, 2018, 1:16pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/340 "2018-05-24T13:16:50Z")

</div>

How long ago have you done the import? These stats are updated in a background job that runs every day/week (_can’t remember_).

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 24, 2018, 2:26pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/341 "2018-05-24T14:26:03Z")

</div>

Hi,  
The import ended at least 6 hours ago. I looked at the sidekiq josb but I couldn’t find anything related to this. There was something like Category stats but it didn’t change anything after it was done.

If it’s updated in a short future any way, that’s not a big deal. Thanks for your reply. 🙂

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [May 24, 2018, 11:51pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/342 "2018-05-24T23:51:58Z")

</div>

I think this number only take the number of topics in this specific category and doesn’t count all subcategories.

I don’t know if it’s a bug or not though

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 26, 2018, 1:59pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/343 "2018-05-26T13:59:00Z")

</div>

Yeah, I got it. In phpbb you could have categories in which you can’t post messages, they just act as parents for subcategories.  
So there is no message in them.

The displayed number for a category only shows posts that are posted in this category but not those posted in a subcategory as you said. Seems weird though.

Another question since I’m here: what happens if I import my phpbb data twice? Does it skip already imported messages/users/passwords/attachments?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 26, 2018, 2:35pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/344 "2018-05-26T14:35:12Z")

</div>

Yes. It skips already imported users and posts.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 30, 2018, 2:55pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/345 "2018-05-30T14:55:41Z")

</div>

Hi!

Still here. 😃 I noticed that my imported images aren’t displayed (404 error) though I imported them in the import settings.  
Any idea how does that come from and if it is possible to fix the issue without having to re-import?

I also reorganized all my categories and moved messages to other categories… I’d prefer not to do all of this again, I hope there is a solution.

edit: I discovered `rake uploads:recover_from_tombstone`. Hope that will help.  
edit2: that helps.

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 30, 2018, 4:10pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/346 "2018-05-30T16:10:20Z")

</div>

That issue being solved, I have another question.  
I imported from a fairly old phpbb dump ; December 2017. I did not notice until I made a lot of configuration and reorganization on my Discourse.  
I can get a recent dump of my phpbb, what would be the proper way to add only the new (from December 2017 until now) messages, uploads and users to my Discourse?

I got that the importer will ignore the existing users categories and stuff but will it identify existing messages if I changed their categories on Discourse?

Also, on the last import I tried, I got the message after starting phpbb3\_import.rb:

```plaintext
Table `phpbb.phpbb3_config` doesn't exist

```

I had my dump named `phpbb_mysql.sql` inside `/var/discourse/shared/standalone/import/data` and I edited `settings.yml` :

```plaintext
table_prefix: phpbb3_ 

```

as it is the prefix on my dump tables:

```plaintext
CREATE TABLE `phpbb3_config`

```

Any idea?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [May 30, 2018, 4:33pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/347 "2018-05-30T16:33:02Z")

</div>

I’m not sure why it doesn’t find the `phpbb3_config` table. There’s probably something wrong with your database dump.

The importer supports incremental imports. Simply put the new `phpbb_mysql.sql` and attachments into `/var/discourse/shared/standalone/import/data` restart the import. The importer uses the original IDs from phpBB3 to identify already imported data, so there’s no need to worry.

Anyway, it’s probably a good idea to create a backup in Discourse before you start the next import. Just in case… 😉

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 30, 2018, 4:54pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/348 "2018-05-30T16:54:55Z")

</div>

Thanks for your reply. My dump seems fine but I do notice some differences between the two dumps.  
Here’s a comparison of the first lines: [https://www.diffchecker.com/ITAyzGCD](https://www.diffchecker.com/ITAyzGCD) (new one on left)

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [May 30, 2018, 4:56pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/349 "2018-05-30T16:56:48Z")

</div>

Try removing

```sql
CREATE DATABASE IF NOT EXISTS `monocycleinfo_forum` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `monocycleinfo_forum`;

```

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [May 30, 2018, 9:00pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/351 "2018-05-30T21:00:46Z")

</div>

Worked like a charm, thanks!

---

<div class="post-metadata">

### Author: ![danmaby](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danmaby/32/119860_2.png) [@danmaby](https://meta.discourse.org/u/danmaby)
#### Post date: [June 5, 2018, 10:29am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/353 "2018-06-05T10:29:52Z")

</div>

Hey all, every time I run step **1.5 Executing the import script**

> [@gerhard](#):
>
> /var/discourse/launcher enter import

I receive the following error in the terminal:

`Error response from daemon: Container [id] is not running`

I’m not clear on how to get the container running? Any advise would be greatly appreciated 🙏

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [June 5, 2018, 11:53am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/354 "2018-06-05T11:53:24Z")

</div>

You should reinstall or restart docker, it’s not coming from Discourse

It is `service docker restart` for the second one I think

---

<div class="post-metadata">

### Author: ![danmaby](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danmaby/32/119860_2.png) [@danmaby](https://meta.discourse.org/u/danmaby)
#### Post date: [June 5, 2018, 12:17pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/355 "2018-06-05T12:17:11Z")

</div>

Thanks @Steven if I stop the discourse/app I can then `enter import` but of course the import fails because Discourse isn’t running. If I run `docker ps -a` this is what I see:

```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0e44d0c41023 local_discourse/import "/sbin/boot" 24 minutes ago Exited (5) 17 minutes ago import
de1aa6a0e624 local_discourse/app "/sbin/boot" 24 hours ago Up 17 minutes 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp app`

```

So if I run `docker stop de1aa6a0e624` I can then run `/var/discourse/launcher enter import` and it starts the import but as I said, of course fails.

Port 443 seems to be the issue, if I try to start the `container [id]` I posted above I see: `Bind for 0.0.0.0:443 failed: port is already allocated`

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [June 5, 2018, 12:25pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/356 "2018-06-05T12:25:37Z")

</div>

I guess for some reason the `import` container wasn’t running when you tried to enter it the first time. Try the following steps:

```bash
/var/discourse/launcher stop app
/var/discourse/launcher start import
/var/discourse/launcher enter import

```

And if that doesn’t work, try

```bash
/var/discourse/launcher stop app
/var/discourse/launcher rebuild import
/var/discourse/launcher enter import

```

[Previous page](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810.md?page=1)

[Next page](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810.md?page=3)
