# 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:** 15

<div class="post-metadata">

### Author: ![jmbeuken](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jmbeuken/32/214923_2.png) [@jmbeuken](https://meta.discourse.org/u/jmbeuken)
#### Post date: [April 15, 2021, 12:44pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/606 "2021-04-15T12:44:15Z")

</div>

Hello,

I just imported my phpBB forum ( v3.2.10 ) without any problem ( thank you @gerhard and al.)…

Well, almost without any problem 😉 : there are no replies in the topics.

 ![import phpBB](https://global.discourse-cdn.com/meta/original/3X/0/e/0e2f4ffae470f0d51dc8c4c8bf7e071a951ee94e.png)

Any ideas?

Thank you in advance

---

<div class="post-metadata">

### Author: ![mstm](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mstm](https://meta.discourse.org/u/mstm)
#### Post date: [April 15, 2021, 2:24pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/607 "2021-04-15T14:24:41Z")

</div>

Hi @jmbeuken, run several times `import_phpbb3.sh` and check on `http://yoursite/sidekiq` if sidekiq finished the job.

---

<div class="post-metadata">

### Author: ![jmbeuken](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jmbeuken/32/214923_2.png) [@jmbeuken](https://meta.discourse.org/u/jmbeuken)
#### Post date: [April 15, 2021, 4:33pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/608 "2021-04-15T16:33:23Z")

</div>

Thank you : it works !

---

<div class="post-metadata">

### Author: ![mstm](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mstm](https://meta.discourse.org/u/mstm)
#### Post date: [April 25, 2021, 9:15am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/609 "2021-04-25T09:15:47Z")

</div>

I realized now that regex only works for the forum’s urls.

 ![regex](https://global.discourse-cdn.com/meta/original/3X/1/b/1b04eda127e9bfe2a2e5a572021d5c6820af8d01.png)

after the conversion i found these preconfigured

`/(viewforum.php\?)(?:.*&)?(f=\d+).*/\1\2` works perfectly but `/(viewtopic.php\?)(?:.*&)?(t=\d+).*/\1\2` always returns 404 error because the address is not converted and remains `https://www.mysite.com/viewtopic.php?t=123`

Why? The regex looks the same and I try from external links.

UP! ( 😬)

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [May 4, 2021, 5:07pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/610 "2021-05-04T17:07:19Z")

</div>

![image](https://global.discourse-cdn.com/meta/original/3X/8/f/8fe74034a03ae79f868808b9e82d4384b2d740d4.png)

It doesn’t appear this is an issue with the permalink normalization regex as it’s selecting properly. Do you have permalinks following the form `viewtopic.php?t=123` under Admin → Customize → Permalinks?

---

<div class="post-metadata">

### Author: ![mstm](https://avatars.discourse-cdn.com/v4/letter/m/6de8d8/32.png) [@mstm](https://meta.discourse.org/u/mstm)
#### Post date: [May 4, 2021, 5:25pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/611 "2021-05-04T17:25:21Z")

</div>

> [@justin](#):
>
> Do you have permalinks following the form `viewtopic.php?t=123` under Admin → Customize → Permalinks?

Hi Justin, no I only have the ones you see in the image.  
[![](https://global.discourse-cdn.com/meta/optimized/3X/1/b/1b04eda127e9bfe2a2e5a572021d5c6820af8d01_2_1380x360.png) ](https://global.discourse-cdn.com/meta/optimized/3X/1/b/1b04eda127e9bfe2a2e5a572021d5c6820af8d01_2_1380x360.png)

Thanks

---

<div class="post-metadata">

### Author: ![Mark\_Winckle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_winckle/32/221653_2.png) [@Mark\_Winckle](https://meta.discourse.org/u/Mark_Winckle)
#### Post date: [May 23, 2021, 12:21am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/612 "2021-05-23T00:21:15Z")

</div>

Hey just stopping by to say thanks for this tip. I’m migrating a largeish PHPBB 3.2 forum to Discourse, around 1.3GB in SQL dump, and I thought I’d fallen at the first hurdle!

By definding `new_categories` as an empty list and `category_mappings` as an empty object, what is that actually doing? Would there be negative consequences?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [June 8, 2021, 5:35pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/613 "2021-06-08T17:35:57Z")

</div>

Those settings only take effect when you’re importing into a Discourse forum with an existing category structure.

---

<div class="post-metadata">

### Author: ![jmbeuken](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jmbeuken/32/214923_2.png) [@jmbeuken](https://meta.discourse.org/u/jmbeuken)
#### Post date: [June 28, 2021, 2:17pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/614 "2021-06-28T14:17:03Z")

</div>

Hello,

I imported a phpBB3 site with 2518 users.  
After some “import\_phpbb3.sh”, everything seems stable…  
I notice however that there are 1108 “level 0” users and 1410 “level 1” users : what is the key to separate the users ?  
Then, the next day, I notice that there are only 258 “level 0” users: how was the “cleaning” done? 0 posts ? no activity?

I tried to transfer the passwords : unfortunately, there are a lot of errors ( username==password, length \< 9, … ) and the script crashes each time : I correct on phpBB3 ( delete the user 😉 ) and I restart the script : it’s too painful and I stopped. 🙄  
Would there be a way, in case of error, to put a default passwd ? (I don’t know Ruby 😔 )

Thank you in advance.

---

<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: [June 28, 2021, 2:32pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/615 "2021-06-28T14:32:52Z")

</div>

You’ll need to add some code that checks the password length and either deletes it or makes it longer than 9 (the minimum is really 8, so I’m not sure about 9).

---

<div class="post-metadata">

### Author: ![jmbeuken](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jmbeuken/32/214923_2.png) [@jmbeuken](https://meta.discourse.org/u/jmbeuken)
#### Post date: [June 28, 2021, 5:12pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/616 "2021-06-28T17:12:14Z")

</div>

Thank @pfaffman  
Sorry, I didn’t make myself clear…  
on the phpBB3 instance, the minimum length was 6 characters, then I changed it to 8 when I updated phpBB3 a few years ago…  
so, potentially, there are a lot of passwords with a length \< 10 ( default for discourse ).

I think we could hack the file “spec/components/validators/password\_validator\_spec.rb” but I have trouble understanding… 😧

A+

---

<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: [June 28, 2021, 6:39pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/617 "2021-06-28T18:39:17Z")

</div>

You could try that but I’m not sure if it will work and it’s tricky to do that such that it won’t get un-done when you upgrade. My easier suggestion is to just not import the too-short passwords. I’m guessing they won’t remember them anyway.

But maybe someone else has another idea.

---

<div class="post-metadata">

### Author: ![jmbeuken](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jmbeuken/32/214923_2.png) [@jmbeuken](https://meta.discourse.org/u/jmbeuken)
#### Post date: [July 2, 2021, 6:41pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/618 "2021-07-02T18:41:37Z")

</div>

Hi,

during the import, there is a problem with upload of files :

```plaintext
4497 / 12442 ( 36.1%) [1122 items/min]  
Failed to create upload: No such file or directory @ rb_sysopen - /shared/standalone/import/data/files/89_d634760ee03ba0148d7a387a19794f90
Failed to upload /shared/standalone/import/data/files/89_d634760ee03ba0148d7a387a19794f90

```

but the file exists :

```plaintext
root@gui2:/var/discourse/shared/standalone/import# ll data/files/89_d634760ee03ba0148d7a387a19794f90
-rw-rw-rw- 1 nwz003 48 125552 Mar 6 2012 data/files/89_d634760ee03ba0148d7a387a19794f90

```

and

in “shared/standalone/import/settings.yml” :

```plaintext
phpbb_base_dir: /shared/standalone/import/data

```

any idea ?

thanks

---

<div class="post-metadata">

### Author: ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)
#### Post date: [July 2, 2021, 9:16pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/619 "2021-07-02T21:16:26Z")

</div>

Try doing `/shared/import/data` in settings – inside the container the `/var/discourse/shared/standalone` directory is mapped to `/shared`

---

<div class="post-metadata">

### Author: ![jmbeuken](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jmbeuken/32/214923_2.png) [@jmbeuken](https://meta.discourse.org/u/jmbeuken)
#### Post date: [July 3, 2021, 11:56am UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/620 "2021-07-03T11:56:57Z")

</div>

Thanks @justin : it’s the trick 🙂

---

<div class="post-metadata">

### Author: ![uckelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/uckelman/32/103854_2.png) [@uckelman](https://meta.discourse.org/u/uckelman)
#### Post date: [July 6, 2021, 8:35pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/621 "2021-07-06T20:35:34Z")

</div>

I ran into this when running `import_phpbb3.sh` on a dump of a phpBB 3.0.12 database just now:

```plaintext
creating user groups
Failed to add user 1 to group 11
PG::NotNullViolation: ERROR: null value in column "user_id" of relation "group_users" violates not-null constraint

```

It turned out that my phpbb databse had “pending” users in the `phpbb_user_group` table. (Pending users are ones who have requested to join a group but have not yet been approved.) I removed the rows where `user_pending` was `1` and the importer was able to continue on after that.

---

<div class="post-metadata">

### Author: ![uckelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/uckelman/32/103854_2.png) [@uckelman](https://meta.discourse.org/u/uckelman)
#### Post date: [July 6, 2021, 11:41pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/622 "2021-07-06T23:41:03Z")

</div>

Another note when importing phpBB 3.0.12: I see a huge number of messages like this when importing posts on the first run:

```plaintext
    65427 / 65812 ( 99.4%) [2238 items/min] Parent post 68380 doesn't exist. Skipping 68382: Shuffling an At Start Stack

```

(“Shuffling an At Start Stack” is the name of the particular thread in my forum.)

When I started the app to browse what had been imported, it looked like what I got was the first post in each thread, but no replies.

Apparently the importer requires a second pass (just running `import_phpbb3.sh` again) on my database. The second time around, all the missing parents seem to exist and I get no missing parent messages.

Importers are hard to write, as is anything which can successfully resume after a problem, and you guys managed to do both here. Bravo!

---

<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: [July 7, 2021, 1:40pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/623 "2021-07-07T13:40:05Z")

</div>

> [@uckelman](#):
>
> Apparently the importer requires a second pass (just running `import_phpbb3.sh` again)

That suggests that there might be a problem in `base.rb` or `lookup.rb`. I noticed a similar problem in the generic json importer, but thought it was an issue with it. It sounds like the lookup functions aren’t working. My guess is that the create post function isn’t adding new posts to the structure that the lookup functions are using.

I’ll try to give it a look in the next day or two.

---

<div class="post-metadata">

### Author: ![uckelman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/uckelman/32/103854_2.png) [@uckelman](https://meta.discourse.org/u/uckelman)
#### Post date: [July 7, 2021, 2:09pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/624 "2021-07-07T14:09:20Z")

</div>

@pfaffman The import that I did was a trial one; I’m likely to do at least one more so if you have something for me to try in a few days I’d be happy to test it.

---

<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: [July 7, 2021, 2:49pm UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/625 "2021-07-07T14:49:39Z")

</div>

Well, it seems like `@topics` and/or `@posts` isn’t getting updated by the topic/post creator. In my script I’ve been searching for the `TopicCustomField` in my code rather than relying on the lookup functions.

I looked at the code and recent commits and don’t see an obvious explanation.

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

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