Updating phpBB2 forum to phpBB3 via local installation
Recently I upgraded a phpBB2 powered forum to the new phpBB3. I theory, this shouldn’t be a problem as the new version provides a script which transfers the old database tables to the new ones. In my case, the conversion stopped somewhere when importing the old database tables. It gave me an error with something like “…end of script…“ - that was it. I guess this was due to some PHP/Apache settings and as my forum is hosted by a simple webhoster, I had no chance of dealing with the settings (no root access). If you run into the same problems maybe the following can be of help.
My initial setup with my webhoster was a phpBB2 forum with no addons running with an apache2 webserver with PHP5 support and a MySQL 4 database as backend. I wanted to run the new phpBB3 forum with the same setup except for the database, which would be MySQL 5 then (this is optional, but I had the choice of creating a new database).
WARNING: This HOWTO worked very well for me. It may fail though and could destroy your forum/forum database. So, follow it at your own risk and always keep backups!
I did the update via a local apache/php/mysql installation. So, what we need to do first is installing a webserver with php support and a MySQL database server to your local machine (or somewhere else where you can become root). This can be done with Windows, too, but I think it’s much easier with a Linux distribution like Ubuntu. You need to install the following packages:
As you may not want those servers to start at boot, you can install rcconf, run it from a terminal (don’t forget
sudo!) and deselect apache2 and all mysql entries.
Once installed, you can alter apaches default document root (the directory which will serve the html/php pages) by editing
/etc/apache2/sites-available/default. Look for those entries:
If the line
has no leading “#”, place one there. Then restart apache:
If you see a message like
Could not determine the server name... add this line to
You can check if everything is up and running, by fireing up your browser and navigating to
http://127.0.0.1/phpmyadmin (cookies required!). Log in to phpmyadmin as root with the password you’ve chosen during package installation. First part done! Now create a new database/user and name them for example “phpbb”. So at phpmyadmin’s start page click on privileges and then on “Add new user”. This will bring you to this page:
Name the user “phpbb”, select “localhost” as host, create a password and don’t forget to choose “Create database with same name and grant all privileges”. _Now click “OK” and you’ll have a new database called _“phpbb” and a MySQL user with the same name who has full access to this database.
Now install phpBB3 to your newly installed web-/MySQL Server by downloading the phpBB3 archive and extracting it to your apache’s document root directory. This should create a subdirectory called “phpBB3”. Open your browser, point it to “http://127.0.0.1/phpBB3” and follow the instructions. You can leave most of the defaults, with one exception: the table prefix MUST NOT be the same as the one you’ve chosen with your “old” phpBB2 installation!! The default for both, phpBB2 and phpBB3, is “phpbb_”. So change it for example to “phpbb3_”. As admin user choose the same username and password as you did for your “old” phpBB2 forum. Depending on your setup, you may also need to make some directories within your phpBB3 directory writable for all. When done, DO NOT remove the
install directory as told by the setup! We’ll need it later on for the conversion.
You should now have a working phpBB3 forum running on you local computer. You can’t login in until you remove/rename the
install directory, but that’s OK for now.
Now we’ll export the “old” phpBB2 database tables and then import them to our local database. Before, you should close your old phpBB2 forum (done via the administration panel), because any changes beyond that point would otherwise be lost. Depending on your webhoster you might have other tools, but I guess mostly phpmyadmin is used for MySQL administration. Assuming this, here’s how to export the database tables via phpmyadmin:
- Login to your webhoster’s phpmyadmin
- select the correct database (if you have more than one)
- select the “Export” tab
- in the upper left window select all your phpBB2 forum tables (by default they should all start with the table prefix “phpbb“_
- all other settings, see screenshot:
You should then be downloading a file called “
Next step is to import the just downloaded *.sql file to your local phpbb database. Again, it is absolutely mandatory that your phpBB2 and your local phpBB3 installation do not have the same database table prefix! OK, now for the import. Open your local phpmyadmin again, from the dropdown menu on the left choose your phpbb database and then select the “Import” tab. Click on the “Search” (-> Location of the text file) button and browse to your downloaded *.sql file. If this file exceeds 2048KiB in size, you can zip it (
gzip file.sql) before importing. If it is still too large, you’ll have to split it. You may open it with any text editor.
Once the import is complete, point your browser to your local phpBB3 installation again and add the “install” directory to the URL. If you followed the instructions above, it should be “http://127.0.0.1/phpBB3/install”. Select the “Convert” tab and then click “Convert” located on the right side of the table. You’ll then have to provide some information about your local database:
- “Database server hostname or DSN:” of course is “127.0.0.1”
- “Prefix in tables for database:” this is the prefix of your “old” phpBB2 database, by default it’s “phpbb_”
- “Board path:” relative path to your downloaded phpBB2 forum files. Again, if you followed the instructions above it’s ”../phpBB2”
The conversion will copy some of your files, like avatars or smileys to you phpBB3 location. Depending on the size of your forum the conversion may take a while, be patient. Once done, you may remove the “install” directory from your phpBB3 installation and when pointing your browser to “http://127.0.0.1/phpBB3” you should be able to login with your admin user. Do a quick check if everything seems right and then log out again. For now don’t change any settings.
It is time to install the new phpBB3 forum to your webspace - but keep a backup of your old forum files!! How to install depends on your webhoster (but it should not be different than installing phpBB2 ;-) ). VERY IMPORTANT: When installing phpBB3 to your webspace, be sure to use the same database table prefix than you did when installing it to your local machine!!! Again, choose the same admin username and password than before. Once installed, you may delete/rename the “install” directory from your phpBB3 installation and do a quick login. If everything went right, we’ll now export the local phpBB3 database tables, do some small modifications and import them to the webhosters phpBB3 database.
Login to your local phpmyadmin again, select your phpbb database, click the “Export” tab and export all tables from your local phpBB3 forum. If you followed the example above, they should have “phpbb3” as prefix. So select all tables with “phpbb3“_ as prefix and export them to a file (
('cookie_domain', '127.0.0.1', 0);-> replace
"127.0.0.1"with the setting “General -> Cookie settings -> Cookie domain” of your web installation
('server_name', '127.0.0.1', 0);-> replace
"127.0.0.1"with the setting “General -> Server settings -> Domain name” of your web installation
('script_path', '/phpBB3', 0);-> replace
"/phpBB3"(depends on your local installation) with setting “General -> Server settings -> Script path” of your web installation
All other settings should be OK. Save the file and import it (like before) to your webhoster’s database. You may also need to copy some files from your local phpBB3 forum directory to your webhoster, so check those directories and copy any missing files/directories:
Keep your old phpBB2 database tables a while and verify that everything went well. You may delete them later, as well as your old phpBB2 files. Now login to your new phpBB3 forum and check all settings.
This should be it! :-)