Knowledge Base

How to move a phpBB 2.0.x board to a new server
Article ID: 4
Written By: Marshalrusty
Written On: Tue Jul 03, 2007 6:06 pm
Description: Detailed instructions on backing up and restoring the files and database, regardless of database size.
Link to this article: Select All
[url=http://www.phpbb.com/kb/article/how-to-move-a-phpbb-20x-board-to-a-new-server/]Knowledge Base - How to move a phpBB 2.0.x board to a new server[/url]

Purpose
    This article explains how to fully move an entire phpBB 2.0.x board, regardless of the database size. If you are moving to a new server or simply need to restore a backup, this will hopefully help you.
Database Backup
    You can use the "Backup Database" option in phpBB's administration panel, but a tool specifically made for database management will do the job better. Most hosts provide phpMyAdmin in their control panels. If yours doesn't, you can always install it yourself.

    In phpMyAdmin, select the database with the phpBB tables and click "Export" on top. Click on the image below for the next step. Image
    After you've done that, click "Go" and save the file to your hard drive.
Files Backup
    I strongly suggest making periodic backups of your site's files and storing them in the same place; I have weekly backups of my sites dating back to 2004. Since you're moving to a different server, you'll need to copy the files over.

    To get a backup of the files, use your favorite FTP Client (Filezilla, SmartFTP, etc.) to copy the server contents to your hard drive. I recommend making at least 2 copies in case you accidentally make an unintended edit.
Restore Database
    Unless you have a very small database (less than a megabyte) or shell access, I recommend using bigdump.php for this. This tool will restore the backup in chunks, rather than all at once, thus preventing memory allocation issues.
    1) On your new server create a folder called 'restore'.
    2) Download bigdump.php.
    3) Unzip the file and open it in a plain text editor, such as Wordpad (not Notepad).
    4) Locate the block of code below and add your new database's info.
    Code: Select all
    $db_server   = "localhost";
    $db_name     = "";
    $db_username = "";
    $db_password = "";

    4) Save the file and upload it to the 'restore' folder on your server.
    5) If your backup is compressed (.zip, .gz, .bz2, etc.), decompress it using a tool such as WinRAR. Upload the .sql or .txt file to the 'restore' folder on your server.
    6) Navigate to bigdump.php in your browser. (ex. http://www.yoursite.com/restore/bigdump.php).
    7) You will now see your backup file with 'Start Restore' to the right of it. Click it and go get a cup of tea. Depending upon the size of the backup, this can take from a few minutes to several hours. After you get the 'Restore Successful' message, be sure to delete the 'restore' folder.

Restore Files
    If you don't have any MODs installed or don't want to keep them, you will be uploading fresh copies of the files. If you do wish to keep your MODs, you will be uploading the files backup you made before. If you are using an outdated version of phpBB and have MODs installed, you may wish to upload fresh files and reinstall the MODs.
    If you don't have MODs installed or are willing to reinstall them
      1) Download a fresh copy of the full package
      2) Unzip the files into a folder (let's call it FolderA).
      3) Take you old config.php file (from your backup) and edit it to reflect the new database. Copy the config.php file you just made to FolderA (overwriting the one currently there).
      4) Delete the contrib folder from FolderA.
      5) Upload the contents of FolderA to your server.
      6) Run install/update_to_latest.php by navigating to it in your browser (ie. http://{your_domain}/{root_path}/install/update_to_latest.php).
      7) Delete the install folder.
      If you did everything correctly, your board should come up when you navigate to it (you are also updated to the latest version of phpBB). If you experience problems, please search for the error message on this site.
    If you want to save your MODs
      Simply upload the files backup you made earlier to your new server. You will need to open config.php in a plain text editor and change the information to point to your new database. If you're running an outdated version of phpBB, be sure to update.

Fixing cookie/domain/script path settings
    If your domain or script path changed during the move, you will likely have trouble logging in due to incorrect cookie settings. The following article explains how to fix this issue.

I hope this has been helpful. If you had a problem with something, please ask in the support forum. If there is a typo/error in this article, please PM me.