I migrated 60k pages from a dead phpBB forum to WordPress using raw SQL
My client had a phpBB forum that died 5 years ago. 60,000 topics, ~180k comments, spanning 2008-2020. He wanted to preserve the content. WordPress was the practical choice (my opinion) for long-term manageability.
Every migration plugin I tried was either abandoned, broke above 5k posts, or couldn't handle phpBB's schema at all. So I wrote a custom PHP script that connected directly to MySQL and streamed data in batches.
The setup:
- Ran everything in Docker: phpBB container (old DB), WordPress container (new DB), PHP script as a third container
- My workflow: if something broke, I'd just
docker compose down -v && docker compose up -dand start fresh from clean images - This let me test aggressively without worrying about corrupting state
The approach:
- Connect to both databases: PDO to phpBB (read-only) and WordPress (write)
- Batch process topics: SELECT with LIMIT/OFFSET, 500 rows at a time. Loop until no more rows
- Map phpBB tables to WordPress:
phpbb_topics+phpbb_posts(first post) -->wp_postsphpbb_posts(replies) -->wp_commentswithcomment_parentphpbb_forums-->wp_terms(categories)phpbb_users--> just usernames (no emails/passwords for privacy)
- Convert timestamps: phpBB uses Unix integers, WordPress wants
YYYY-MM-DD HH:MM:SS - Handle comment threading: iterate replies in order, chain
comment_parentto previous ID - Add indexes on temp tables before big JOINs: otherwise 60k rows is slow
What I removed:
- User emails and passwords (privacy)
- Profile pictures (not worth it for dead forum)
Results:
- 60,247 topics --> 60k WordPress posts
- ~180k comments with threading
- All timestamps preserved (2008-2020)
- Some data was lost
- Total time: 1 day including testing, debugging, redoing from scratch 7 times
Bonus: Client found a way to monetize the archive (backlinks... somebody's still buying them). So dead forum became an asset.
If you want the code, describe the setup to any AI and it'll generate it, the approach above is the hard part.
Anyone else done migrations this big?