Knowledge Base

Transferring Your Board to a New Host or Domain
Article ID: 845
Written By: AdamR
Written On: Wed Aug 31, 2011 2:23 am
Description: This article explains in-depth how to move your forum from one hosting provider to another or from one domain name to another.
link to this article on phpbb.com: Select All
[kb=transferring-your-board-to-a-new-host-or-domain]Transferring Your Board to a New Host or Domain[/kb]
link to this article on your own board: Select All
[url=http://www.phpbb.com/kb/article/transferring-your-board-to-a-new-host-or-domain/]Knowledge Base - Transferring Your Board to a New Host or Domain[/url]

Purpose

This article explains in-depth how to move your forum from one hosting provider to another (different or same domain) or from one domain to another on the same host. These instructions are only intended to work with MySQL databases.

Requirements

  • You will need FTP access to your server. You will also need an FTP client. The client which is used during the course of this article is FileZilla.
  • It is highly recommended (although not required) that you have access to phpMyAdmin in order to make a backup of your database. Most hosting providers offer this application. It should be available in the databases section of your hosting control panel (cPanel, Plesk, etc). If you are unsure of how to access phpMyAdmin, you should contact your hosting provider for details.
  • For larger databases (greater than 2MB exactly) you will likely be unable to restore the backed up database via phpMyAdmin. Because of this, you will need to use a program called BigDump to restore the database. BigDump can be obtained from here. Instructions will follow on the proper usage of BigDump. Alternatively, you can use SSH to restore the database (details below).
  • You will need a basic text editor. For Windows: Notepad++. For OS X, use Text Edit. For GNU/Linux, use GEdit or KEdit depending on your desktop environment. You may also choose to use another text editor of your choice. Do not use a word processor such as Microsoft Word or program such as Adobe Dreamweaver.
  • (Optional) If your hosting provider(s) offers SSH (Secure Shell) access to your server, this is the preferred method of backing up and restoring a database. Check with your hosting provider(s) for details. For Windows, you will need an SSH client such as PuTTY. For GNU/Linux and OS X, SSH is built directly into the Terminal.

Preparation

This step will prepare your board for the transfer.

Visit your old board’s Administration Control Panel. On the General tab, select the Server settings link on the left-hand side of the page. Ensure Force server URL settings is set to NO, as shown in the image below.

Image

Select the Board settings link on the left-hand side of the page. Ensure Disable board is set to YES.

Backup

Backing up the phpBB Files

Here, we will get a backup of your phpBB directory and database. Using FileZilla, connect to your old domain name. Browse to the location of your phpBB directory and copy its contents to a folder on your computer, as shown in the image below:

Image

Ensure all files and folders have been properly transferred.

NOTE: Ensure your FTP program is set to use "Binary" mode for files with no extension. In FileZilla, this can be changed by going to Edit > Settings > Transfers > File Types and unchecking the box next to "Treat files without extension as ASCII file." See http://www.phpbb.com/kb/article/transfe ... filezilla/

Backing Up the Database

Select one of the three options below to back up your database. Use whichever one is best based on your needs and what tools you have available to you.

1) Using phpMyAdmin to Back Up the Database

Load phpMyAdmin. Depending on how phpMyAdmin is set up on your server, the images shown below will be slightly different.

IMPORTANT: If you are using phpMyAdmin 3.4.3.2 or higher, please follow the instructions in this quote box to backup your database.

1. Click the "Export" tab (screenshot).

2. Click the "Custom - display all possible options" radio button. This will display several options. Click your database to highlight it. Select the "Save output to a file" radio button. Give your backup a name, and set compression to None. Under FORMAT, select SQL from the dropdown menu. Under the Format-specific options section, select the radio button next to "structure and data" under Dump table. Under the Data-dump options, make sure the radio button next to "include column names in every INSERT statement" is selected. Finally, click "GO" at the bottom (screenshot).


Select your forum’s database from the drop down box in the left-hand frame.

Image

In the right-hand frame, select the Export tab. In the Export section of this page, be sure to choose Select All as well as the SQL radio button. In the Options section of this page, ensure the Add DROP TABLE checkbox is checked.

Below this setting in the Data section, ensure Complete inserts is checked, and Extended inserts is unchecked.

Image

At the bottom of the page, check the Save as file box. Leave the file name as default and select gzipped as the compression.

NOTE: Some hosting providers will not offer gzip as an option. Check with your hosting provider to see if this is offered. However, the majority of providers will have this available. If gzip is not an option, choose None instead.

Any other setting not directly mentioned above should be left at its default value.

Click Go and save the file to your computer. Proceed to the Restore section.

2) Using SSH to Back Up the Database

Open an SSH connection to your server and browse to the location where you wish to store the backed up database file. Run the following command to back up the database:

Code: Select all
mysqldump -u USERNAME -p PASSWORD --default-character-set=utf8 DATABASE_NAME | gzip > NAME_OF_FILE.GZ

Be sure to substitute USERNAME and PASSWORD with the correct database username/password values. Also be sure to substitute DATABASE_NAME with your newly created database name and NAME_OF_FILE.GZ with the full name of the database backup GZ file.

Open an FTP connection to your server and browse to the location where this file is stored. Transfer it to your computer.

3) Using the phpBB ACP to Back Up the Database

This option is a good solution for smaller boards with below-average sized databases or for users who do not have access to phpMyAdmin.

Visit your old board’s Administration Control Panel. Select the Maintenance Tab. On the left-hand side, click Backup.

Ensure all the options are selected as shown in the image below. Be sure to click the Select all button before proceeding with the backup.

NOTE: Some hosting providers will not offer gzip as an option. If it is not listed, choose Text instead.

Image

Click Submit. Depending on the size of the database and your server's configuration, this will take a few moments to process. You will be presented with a file for download. Save this to your computer.

Restore

Restoring the Database

On your new hosting provider/domain, create a new blank database which will contain the transferred forum’s database. Take note of the database name, username, and password.

Select one of the three options below to restore your database. Use whichever one is best based on your needs and what tools you have available to you.

1) If the database file is less than 2MB (exactly), follow these instructions

Load phpMyAdmin on your new hosting provider/domain. Select the new database from the drop down menu on the left-hand side. In the right-hand window, select the Import tab. Browse your computer for the database file. Be sure the Character set is set to utf8.

Click Go. Depending on your internet connection, this may take a few moments to load. If all went well, you will be presented with a confirmation message. Proceed to the next step.

2) If the database file is greater than 2MB (exactly) and you wish to use BigDump, follow these instructions

Extract the contents bigdump.zip file and open bigdump.php in your text editor.

Find the following section of code and fill it in appropriately with your database name, username, and password:

Code: Select all
 // Database configuration

$db_server   = 'localhost';
$db_name     = '';
$db_username = '';
$db_password = '';

Most will leave $db_server at its default value of localhost. However, if your hosting provider has specified a different database server/IP, be sure to change it accordingly. The name of the $db_server will be in your config.php file as $dbhost. If you are unsure, contact your hosting provider to find out.

Edit the following line:

Code: Select all
$db_connection_charset = '';

To this:

Code: Select all
$db_connection_charset = 'utf8';

Also edit this:

Code: Select all
$linespersession  = 3000;   // Lines to be executed per one import session
$delaypersession  = 0;

To this:

Code: Select all
$linespersession  = 3000;   // Lines to be executed per one import session
$delaypersession  = 300;

Save the file.

With FileZilla, open an FTP connection to your server. Create a new directory somewhere on your server and name it dump. Set the permissions of this folder to full write. Most often, you will need to right click the file and select File permissions or Properties. Set the permissions to 777, as shown below.

Image

Upload both bigdump.php and your database backup file to this directory. Point your browser to the dump/bigdump.php file on your new domain. Follow the on-screen instructions to import the database backup file.

Depending on the size of the backup, this will take some time to complete. Please do not close your browser during this process. You will receive a confirmation message when it is complete. After this is complete, delete the dump folder from your server. Proceed with the instructions.

3) If you wish to use SSH to restore the database backup, follow these instructions

Upload the database backup SQL file to a location on your server via FTP.

Open an SSH connection to your server and browse to the location where this SQL file is located. Run the following command in SSH to restore the database.

Code: Select all
gunzip < NAME_OF-FILE.GZ | mysql -u USERNAME -p PASSWORD --default-character-set=utf8 DATABASE_NAME

Be sure to substitute USERNAME and PASSWORD with the correct database username/password values. Also be sure to substitute DATABASE_NAME with your newly created database name and NAME_OF_FILE with the full name of the database backup SQL/GZ file.

  • IMPORTANT: The command above will only work if the database was gzipped when exported. If, however, the database was not gzipped or your chose "Text" or "None" in the above steps, use the following command instead:

Code: Select all
mysql -u USERNAME -p PASSWORD --default-character-set=utf8 DATABASE_NAME < NAME_OF-FILE


Depending on the size of the database backup, this may take a few moments to complete. If there have been no errors, you will be brought back to the prompt.

Restoring the phpBB Files

Upload the backed up phpBB files to the location you desire on the new server via FTP.

Final Steps

Rebuilding the config.php file

Please reference the following article for the steps necessary to rebuild your config.php file and replace the old one:
http://www.phpbb.com/kb/article/rebuild ... gphp-file/

Updating your database

Please note that this step is only necessary if your phBB version on the new host is higher than the version on the old host.

Use FTP to upload the /install folder from the phpBB version you have installed on the new host. Then browse to http://www.your_domain/your_forum_folder/install/database_update.php. When the script is done, delete the /install folder.

Changing your board’s cookie settings

Please note that this step is only necessary if you have moved to a new domain name.

Reference the following article for the steps necessary to update your new board's cookie settings:
http://www.phpbb.com/kb/article/fixing- ... -settings/

Congratulations!

  • 1263276000 - edited by ric323 to note FTP should use binary mode for files with no extension.
  • 1263308381 - added further clarification to the above edit as suggested by RMcGirr83
  • 1263802302 - Bug #56755
  • 1267643116 - edited by stevemaury to clean up MySQL syntax
[*]1340036412 - edited by stevemaury to add database updating instructions[/list]