How to rehost your forum

Note: this post was updated September 13, 2019 to bring it up to date.

It can be hard to break up with your web host, particularly if you have phpBB on it. phpBB consists of files plus a database, and the database is stored separately. phpBB does have a knowledge base article on rehosting. You may want to refer to it. In this post I add my own thoughts and document my own processes, since I do a lot of this for a living.

Ask your new host to do it

Some hosts will move your forum along with your whole website for free for you to get your business. If they don’t, you might ask them if they will. This is a great way to go, providing they do it properly. Some hosts will move the files and forget the database, or leave that part for you. Some will do both but won’t integrate the two by fixing phpBB’s config.php file. There are sometimes other issues. File and directory permissions may change moving to a new host, that might cause issues. Of course you can always hire me to do it for you. Regardless, if your host moves your forum for you, you should still check their work. You might want to start at step 8 below as additional configuration may be needed.

The process

The general steps are:

  1. Buy and setup new hosting
  2. Disable the forum
  3. Download a copy of the forum’s database
  4. Download a copy of the forum’s files
  5. Optional: change your hosts file so you can access your domain on the new host
  6. Upload your files to the new host
  7. Recreate the database
  8. Reconfigure the config.php file and adjust your PHP version if needed
  9. Test
  10. Recreate any email addresses
  11. Change the domain to point to the new host
  12. Monitor and fix settings as needed

Buy and setup new hosting

You have probably done this already. I have recommendations on my rehosting page for new hosts if you are still shopping. In some ways figuring out who deserves your business is the hardest part because the new host must be able to handle your forum’s traffic without breaking a sweat, including during spikes of traffic.

After paying for the hosting, make sure you can access it. Typically the host will provide access credentials to a web host control panel, usually cPanel or Plesk. Test your access. You need to do three things:

  1. You need to know the name of the nameservers to use. You will need this for the final step. There should be two of them, and they usually start with “ns”. They are often in an introductory email you get when you pay for hosting.
  2. Create FTP credentials. Often these are created for you, in which case make sure they work by testing them with your FTP program. Because your domain has not moved yet, you usually access FTP using an IP address.
  3. Make sure you can create a database. Look in the web host control panel for database options. In cPanel look for a MySQL or MariaDB databases option.

Disable the forum

For consistency you should disable your forum (ACP > General > Board settings) before backing up anything. You might want to first send out a mass email or post announcements indicating that the forum is being moved, so your users aren’t alarmed.

Download a copy of the forum’s database

Use a phpBB database backup

phpBB has a database backup program built into it. You can often backup your database successfully this way with this option. ACP > Maintenance > Database > Backup. For action, select Download if available. In newer versions of phpBB, this option is no longer available due to security concerns. Press Select All to ensure all the tables in your database are backed up. When you submit the form your browser should soon note a file being downloaded. If this is not an option, or you chose a local backup, look for the file in your forum’s /store folder and download it with FTP. It should have a timestamp with today’s date date on it. The file name should start with backup_.

Use a backup generated by phpMyAdmin

In your web host control panel, phpMyAdmin should be available. You can use it to export your database. Again, you want to download the result. Check the first link to see how this is done. If you are not using MySQL or MariaDB, consult your database tool to figure out how to get an appropriate backup. I recommend downloading the database as a .sql.gz file.

Backup your database from the command line

In some unusual circumstances you may need command line (SSH) access to backup the database. In addition to SSH credentials, you will need credentials to login to mysql from the command prompt. Describing this procedure is too lengthy for this post, but you can use a search engine to learn how to do this. It is challenging!

Check the integrity of the backup

This step is critical. On some hosts (shared hosting in particular) you may not get a complete backup due to resource limitations. Open the archive using an unarchive tool. This will result in a file with a .sql suffix. Use an editor to view it. Look at the bottom of the file. It should end with the phpbb_zebra table. For the MySQL or MariaDB, the last character should be a semicolon(;). If you don’t have a complete backup, you will have to get one. This may require an awkward call to your old web host for help.

Download a copy of the forum’s files

I am assuming that your do not have a larger website to move. When moving a domain you need to move all web accessible files for the domain. If you have WordPress as a front end, you will need to move WordPress too, using a procedure similar to the one for phpBB.

You can use your FTP program to download your files. This approach is often very time consuming, particularly if you have lots of files in the forum’s files folder or you need to move an entire website. For phpBB only, make sure you only download the folder containing your forum.

A better way is to use your old host’s file manager. Select all the files in the forum’s folder, or for an entire site select all the files in the web root folder. Click on the first file, scroll to the bottom then while holding the shift key click the last file. This should get all files and folders. Look for a compress option. It will create a .zip or .tar.gz file. Once the archive is generated, download it with your FTP program.

For large sites, you may run out of file space doing this step. If you do, delete the archive without sending it to trash. You will have to download all the files and folders individually.

Optional: change your hosts file so you can access your domain on the new host

While this is optional, it’s almost required as it makes the rest of the work so much easier. You want your computer to use your new domain name transparently even though you have not pointed your domain to your new host yet. Instructions for Windows are here, instructions for Mac are here. You need the IP of your new host to make this trick work. When done when you use your domain name in the browser it should see your new hosting. In most cases you will see a default web page for the domain.

Upload your files to the new host

  1. Create the directory for your forum. It should be named the same as on your old host. Where to place it? It must be in a web accessible directory for your domain. Your web folder will vary but it’s usually in a html or public_html folder.
  2. Delete any files that may be there. With new hosting, some default files are usually placed in the main web folder. These should be deleted. There is no harm in keeping a cgi_bin folder if it is there.
  3. Upload your files. If you have an archive, simply upload that to your forum’s folder, otherwise upload the thousands of files that comprise the software and data for your forum. If uploading an archive, use the file manager on the new host to unarchive it. Be careful as you may upload it to the wrong space or you may be actually uploading a folder in the space with the files inside the folder.
  4. Double check that the files uploaded are in the correct folder and that nothing is missing.
  5. Check your file permissions. On Unix-based systems the following folders need to be world-writeable (777 permissions): cache, files, store and images/avatars/upload. Fix if necessary. All other files should have Unix 755 permissions.

Recreate the database

  1. In your web host control panel, create a new database for your forum. Sometimes you can specify the database name, sometimes you can only specify part of the database name. Write the name of the new database down.
  2. Next, create a database user that will be allowed to access the database. You also have to assign a password to the database user. Make it a complex password and write it and the database user name down.
  3. Give the new database user permissions to the database. Make sure you grant ALL permissions.
  4. Determine the name of the database server. It is usually on the same machine as your web server and can be referenced as localhost. But if it’s something different, write it down.
  5. Try importing the database using phpMyAdmin (for MariaDB or MySQL). Select your new database, then the import tab. Point it to your database extract and let it upload. Once uploaded it should be read, recreating your forum’s tables. If the file is too big to be uploaded, you got to be more creative. In most cases you need a staggered importer, which generally means uploading and configuring bigdump.php. If the database was partially loaded, make sure you drop all tables in your new database first using phpMyAdmin. bigdump.php must be edited with the correct database settings before being run. Upload the database extract archive to the same folder as bigdump.php. Run bigdump.php by specifying the correct URL based on where you uploaded it. If you didn’t change your hosts file, you will need the IP of your new server. In addition, you may have to specify a folder in the URL after the IP. Often the letter you get with new hosting will contain this information, otherwise ask you new web host.
  6. Check that everything is moved. You should use phpMyAdmin on your new host in one tab, and phpMyAdmin on your old host in another tab. Make sure all tables in the old database are in the new database and that each table in the new database contains the same number of rows as in the old database. Check a few tables to make sure the structure of the table looks reasonable. In most cases there should be a primary key and one or more indexes for a table.

Reconfigure the config.php file and adjust your PHP version if needed

Most likely the config.php file you copied over won’t work as is. Most likely the database name, the database user name and the database password are all different. You can usually edit this file with your web host’s file manager. Bonus tip: if you are running PHP 7.0 or higher, you must change the line:

$dbms = 'mysql';

to:

$dbms = 'mysqli';

Also, using your web host control panel, check to see what version of PHP you are using by default. phpBB 3.2 can use up to PHP 7.2. Do not use PHP 7.3! Use the highest version allowed. PHP 7 offers about 50% better performance than PHP 5.x and doesn’t have security issues.

Test

Using your browser, enter the URL for your forum and hope it comes up. There may be a delay of several seconds as new cache files are recreated. Fix any errors you find, which can be challenging. Your web host can help or you can hire me. Reenable the forum and test it. Make sure your style looks right, your logo is properly placed, all the forums are on the index and you can make a test post successfully. Also, send yourself a test email to make sure the email interface is working: ACP > General > Email settings. Change as necessary. If you have SMTP as an option, you may want to configure phpBB to send email via SMTP. See this post.

Recreate any email addresses

When you move your domain, you should also recreate any email mailboxes and email forwards you set up for the domain. Unless email for the domain is hosted elsewhere, you should recreate these email boxes, such as your board contact email address. If you had any email forwarders, set these up too. The web host control panel usually has an interface to do both of these easily.

Change the domain to point to the new host

You are ready to go live! First, enable the forum. Next, go to your domain registrar. Enter the new nameservers carefully in the appropriate fields for the domain. Then wait for the DNS changes to propagate. These days most changes happen in 1-3 hours. Your users will know they hit the live forum because the forum is disabled message will not appear. Also, if you changed your host file, undo those changes.

Monitor and fix settings as needed

There are often minor hiccups in the software on a new host. There may be some PHP settings that have to be tweaked. Expect a few of these and you may need some help from your web host. Things generally settle down within a few days.

Leave a Reply

Your email address will not be published. Required fields are marked *