Migrate a phpBB3 forum to Discourse


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

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

Any ideas?

Thank you in advance

1 Like

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


Thank you : it works !


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

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! ( :grimacing:)


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?


Hi Justin, no I only have the ones you see in the image.


1 Like

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?

1 Like

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

1 Like


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 :wink: ) and I restart the script : it’s too painful and I stopped. :roll_eyes:
Would there be a way, in case of error, to put a default passwd ? (I don’t know Ruby :pensive: )

Thank you in advance.

1 Like

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).


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… :anguished:


1 Like

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.

1 Like


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

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 :

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


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

phpbb_base_dir: /shared/standalone/import/data

any idea ?


1 Like

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


Thanks @justin : it’s the trick :slight_smile:


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

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.

1 Like

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

    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!


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.

1 Like

@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.

1 Like

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.

1 Like