# 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:** [05.Июль.2015 22:02:57 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810 "2015-07-05T22:02:57Z")
**Posts on this page:** 20
**Page:** 4

<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: [20.Июнь.2018 22:56:27 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/377 "2018-06-20T22:56:27Z")

</div>

Hi, I have another idea.

I guess that `import_id` is equal to the phpbb post id?  
Since I merged topics from category A and B in category C,

I could:

1. Store all the phpbb topics id from topics that belong to my categories A and B in a json file, then
2. Iterate the json, get the corresponding discourse topic on each iteration
3. Update the discourse topic by changing their category from C to A or B (maybe via /topics/bulk) in each iteration

Would that do the trick on the paper?

edit : I post here since my message mentions a custom\_field relative to the phpbb import, I hope I’m not too much off topic!

---

<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: [20.Июнь.2018 23:18:54 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/378 "2018-06-20T23:18:54Z")

</div>

> [@Canapin](#):
>
> I guess that `import_id` is equal to the phpbb post id?

That part is definitely correct!

Something like your idea could definitely work if you have a mapping of the PHPbb post ID with the category you want.

> [@Canapin](#):
>
> edit : I post here since my message mentions a custom\_field relative to the phpbb import, I hope I’m not too much off topic!

Yeah, this is pretty far afield from anything to do with phpBB. 🙂  
@codinghorror will probably want to split this off into its own topic.

---

<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: [20.Июнь.2018 23:30:38 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/379 "2018-06-20T23:30:38Z")

</div>

Thank you, I’m going to work on this one.  
And sorry about the off topic!

Edit : my script worked well, so here’s how I did, in case it would interest some people who’d like to “unmerge” a category after reorganizing their phpbb topics into Discourse:

1. Installed [Discourse Data Explorer](https://meta.discourse.org/t/data-explorer-plugin/32566)
2. Get the Discourse imported posts from the category of your choice with this query and download the result as a json:

```SQL
SELECT
topics.id as d_topic_id,
slug,
value as phpbb_topic_id
FROM topics
JOIN topic_custom_fields
ON topic_id = topics.id
AND name = 'import_topic_id'
AND category_id = 5

```

3.Get the phpbb topic list from the category(ies) of your choice from phpmyadmin and export the result as a json:

```SQL
SELECT topic_id FROM phpbb_topics
JOIN phpbb_forums
ON phpbb_topics.forum_id = phpbb_forums.forum_id
AND phpbb_forums.forum_id = 20

```

Then you can loop iterate one of your json, and on each iteration if `phpbb_topic_id` is also present in the second array, then you can move it to a new category of your choice.  
To do so I used [GitHub - communiteq/discourse-api-php: PHP API client for Discourse · GitHub](https://github.com/communiteq/discourse-api-php) and added a method to update the category of a topic.

---

<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: [24.Июнь.2018 16:55:04 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/380 "2018-06-24T16:55:04Z")

</div>

Any update on phpbb 3.2 support? There are thousands of phpbb forums out there and we’d love to move to Discourse if we can save the community. We have 2000 users and tired of looking like it is 2002. PHPBB is a huge pile of old outdated forum principles, extensions that are obsolete and not supported, sprinkle it with a lot of pain in the UI, etc. Everytime we go into the admin control panel, God kills a cat. And the **only** thing that is stopping us from moving over to something better is exporting all the existing content.

I’d love to work on it but I have no experience in Ruby and database.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [24.Июнь.2018 18:52:34 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/381 "2018-06-24T18:52:34Z")

</div>

If you can at least partially sponsor the work we can take it on.

---

<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: [25.Июнь.2018 03:58:25 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/382 "2018-06-25T03:58:25Z")

</div>

Have you got a budget? If not, is your community interested in chief sourcing?

---

<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: [25.Июнь.2018 12:07:09 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/383 "2018-06-25T12:07:09Z")

</div>

Hi, quick question.

After I’ve imported my phpbb topics, the messages containing a youtube link don’t embed the video.  
It appears that they uses the following syntax:  
`[youtube.com/watch?v=HT7fbRvx4Sk](http://www.youtube.com/watch?v=HT7fbRvx4Sk)`

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

How can I batch convert all these links to embed videos? The links which are not on a single line shouldn’t be embedded also, obviously.

---

<div class="post-metadata">

### Author: ![jhf2442](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jhf2442/32/131921_2.png) [@jhf2442](https://meta.discourse.org/u/jhf2442)
#### Post date: [08.Июль.2018 08:02:17 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/384 "2018-07-08T08:02:17Z")

</div>

Hi,

also wanting to convert from phpbb3.2 to discourse

had a look at my DB, post\_text still has HTML format (with t, br, i … tags - no idea what t is ?). Also re-ran reparser:reparse multiple time, but nothing changed in the DB. Does somebody have an example of the xml format ?

also could the few devs here give an order of magnitude for the costs for developing a phpbb3.2 converter ? 1k? 5k ? Maybe we could try to get the money together through some kind of kickstarter ?

finally : should we continue (technical) discussion here or start a new thread ?

---

<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: [08.Июль.2018 08:52:31 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/386 "2018-07-08T08:52:31Z")

</div>

If you check out [Redirecting…](https://www.literatecomputing.com/discourse-migration/) you can get some idea what a migration would cost.

Since Gerhard is apparently part-way through his work, it rather complicates giving you a good price since there are many unknowns (I dont’ know about your data or the code the Gerhard hasn’t produced).

If you contact me directly with answers the questions on my above link I could start to give you a ballpark figure if I knew more about your situation. Knowing what I know now, would say that somewhere between $1000 and $5K is probably right. 😉

---

<div class="post-metadata">

### Author: ![FoohonPie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/foohonpie/32/119648_2.png) [@FoohonPie](https://meta.discourse.org/u/FoohonPie)
#### Post date: [09.Август.2018 10:07:43 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/387 "2018-08-09T10:07:43Z")

</div>

@gerhard is there anything we can do to help? I have a 3.2 community that’s just aching to be moved to Discourse. I’d love to contribute if I can in any way.

Thanks.

---

<div class="post-metadata">

### Author: ![Flexinoodle](https://avatars.discourse-cdn.com/v4/letter/f/9fc29f/32.png) [@Flexinoodle](https://meta.discourse.org/u/Flexinoodle)
#### Post date: [15.Сентябрь.2018 00:09:52 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/388 "2018-09-15T00:09:52Z")

</div>

Did the phpbb 3.2 importer ever get released ?

---

<div class="post-metadata">

### Author: ![legrit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/legrit/32/90307_2.png) [@legrit](https://meta.discourse.org/u/legrit)
#### Post date: [19.Сентябрь.2018 14:02:54 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/389 "2018-09-19T14:02:54Z")

</div>

ho, I got this error at this step

> /var/discourse/launcher enter import  
> import\_phpbb3.sh # inside the Docker container

`/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mysql2-0.5.2/lib/mysql2/client.rb:90:in`connect’: **Access denied for user ‘phpbb’@‘localhost’ (using password: YES) (**  **Mysql2::Error::ConnectionError** **)**`

my mysql server is running and accessible from the outside (I can connect from my desktop computer)  
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: [19.Сентябрь.2018 14:25:10 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/390 "2018-09-19T14:25:10Z")

</div>

`localhost` inside the Docker container is different from `localhost` on your desktop. You should configure the database host inside `settings.yml` accordingly if you want to use a remote database. Either use the MySQL server’s IP address or it’s hostname if it can be resolved via DNS.

---

<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: [19.Сентябрь.2018 14:26:38 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/391 "2018-09-19T14:26:38Z")

</div>

The error is access denied. Have you set the username and password to what’s in the config?

---

<div class="post-metadata">

### Author: ![legrit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/legrit/32/90307_2.png) [@legrit](https://meta.discourse.org/u/legrit)
#### Post date: [19.Сентябрь.2018 15:27:03 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/392 "2018-09-19T15:27:03Z")

</div>

> [@legrit](#):
>
> 2.5.0

thanks  
changing localhost to the server ip in import/settings.yml worked

also for some reason I couldn’t make the import work on test-passed discourse (I had to settle to stable discourse)

---

<div class="post-metadata">

### Author: ![Carlo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carlo/32/79036_2.png) [@Carlo](https://meta.discourse.org/u/Carlo)
#### Post date: [20.Сентябрь.2018 19:20:45 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/393 "2018-09-20T19:20:45Z")

</div>

Hi There! I know this is an old reply, but I am having the exact same error.

Any idea how you fixed it ? Thanks

Edit: It seems that something goes wrong at the step:

> [@gerhard](#):
>
> ```plaintext
> nano containers/import.yml
> 
> ```
> 
> Add `- "templates/import/phpbb3.template.yml"` to the list of templates. Afterwards it should look something like this:
> 
> ```plaintext
> 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"
> 
> ```

---

<div class="post-metadata">

### Author: ![legrit](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/legrit/32/90307_2.png) [@legrit](https://meta.discourse.org/u/legrit)
#### Post date: [20.Сентябрь.2018 23:19:51 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/394 "2018-09-20T23:19:51Z")

</div>

using passwords: true

any idea why the hash imported is not the same as the one in phpbb3 ?

phpBB3 :  
$2y$10$Ajp2T5vo.Eh0CG3xW8.g..VzCKSIhtguYO2crP1kH/pDgsYeLtLa.

on discourse : user.custom\_fields[‘import\_pass’]  
$CP$$H$95erUzAMWdt/myFvDN8Rqn12TnIGfU1

I can’t login unless I put the phpbb3 one manually

---

<div class="post-metadata">

### Author: ![marianord](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marianord/32/90502_2.png) [@marianord](https://meta.discourse.org/u/marianord)
#### Post date: [20.Сентябрь.2018 23:49:58 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/395 "2018-09-20T23:49:58Z")

</div>

Sorry, I don’t really remember how I fixed it. I know I struggled a little and then it worked, but I made changes until it worked.

---

<div class="post-metadata">

### Author: ![Carlo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carlo/32/79036_2.png) [@Carlo](https://meta.discourse.org/u/Carlo)
#### Post date: [21.Сентябрь.2018 08:39:21 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/396 "2018-09-21T08:39:21Z")

</div>

No prob, thanks for your answer anyways 👍

---

<div class="post-metadata">

### Author: ![Carlo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/carlo/32/79036_2.png) [@Carlo](https://meta.discourse.org/u/Carlo)
#### Post date: [21.Сентябрь.2018 08:48:14 UTC](https://meta.discourse.org/t/migrate-a-phpbb3-forum-to-discourse/30810/397 "2018-09-21T08:48:14Z")

</div>

**UPDATE: It worked**

I went through the same process and it worked this time 😃

The only thing I did differently is not to install cloudflare template.

And `scp path/to/phpbb_mysql.sql root@[IP Address of your droplet]:/var/discourse/shared/standalone/import/data` works fine!

* * *

Hi there,

Sorry me again but I’m really struggling to import phpBB. I am following the guide above, but somehow it breaks my installation of Discourse.

I not able to import the database, and I am getting the errors below:

**When I try to run the importer**

```
Loading database dump into MySQL...

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

```

**When I try to Rebuild**

```
FAILED

--------------------

Pups::ExecError: socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 &amp;&amp; echo postgres already running stop container ; exit 1 failed with return #&lt;Process::Status: pid 45 exit 1&gt;

Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec failed with the params "socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 &amp;&amp; echo postgres already running stop container ; exit 1"

69b09f1906a3aaf8bcd31201b13ae4dba64568ab8c38a0261d0b4390279848ea

**FAILED TO BOOTSTRAP** please scroll up and look for earlier error messages, there may be more than one

```

Fortunately it’s a fresh install of Discourse 🤣

* * *

_My server is: Ubuntu 16, Last Version of Discourse, failtoban installed_  
_And I am trying to import phpBB version 3.1.6_

_Cloudflare template installed too ( not sure if this affect the whole process )_

* * *

So I guess something goes wrong at **step 1.2** 🤔

Just to make sure:

1 - I create the import.yml like that:

```
cd /var/discourse
cp containers/app.yml containers/import.yml

```

Then add the template - “templates/import/phpbb3.template.yml” to it.

`nano containers/import.yml`

Then run :

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

```

That’s it ? Am I missing something ?  
Should I remove the cloudflare template fro that file ?

**Step 1.3**

There is where I completely lost.

Question aside, can I run this command from localhost in order to upload the sql dump ?

`scp path/to/phpbb_mysql.sql root@[IP Address of your droplet]:/var/discourse/shared/standalone/import/data`

But it doesn’t seem to be working.

Let’s say I want to use the remote connection instead, and edit settings.yml

database:  
type: MySQL # currently only MySQL is supported  
host: localhost ( **to be changed with the ip ?** )  
port: 3306  
username: root ( **should I use the ssh login or database username ?** )  
password: ( **same here, it is for the ssh access** ) ?  
schema: phpbb ( **is this the database name ?** )  
table\_prefix: phpbb\_ # Change this, if your forum is using a different prefix. Usually all table names start with phpbb\_  
batch\_size: 1000 # Don’t change this unless you know what you’re doing. The default (1000) should work just fine.

And after editing settings.yml, I only have to run ?

```
/var/discourse/launcher enter import
import_phpbb3.sh # inside the Docker container

```

Really sorry about all this questions, and thanks if you have the courage to read all this

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

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