Blog

How to rehost your forum

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.

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
  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 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. 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.

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. Use an editor to view it. Look at the bottom of the file. It should end with the phpbb_zebra table. For MySQL/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.

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. 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.
  3. Double check that the files uploaded are in the correct folder and that nothing is missing. You can delete the archive file now if you want.
  4. 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 the import tab for your database. Point it to your database extract and let it be uploaded. 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

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 may need to change the line:

$dbms = 'mysql';

to:

$dbms = 'mysqli';

Test

Hold your breath. 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.

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.

Change the domain to point to the new host

You are ready to go live! 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. Sometimes you may have to upgrade or downgrade the version of PHP used. 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.

March 2018 work summary

What a busy month during March! The first week was a bit slow but pretty much the rest of March I was busy serving clients, many of them commercial clients, which likely made it a record month for work billed, not all of which has been paid yet. A summary of the work is below. As always, who I did the work for has been kept anonymous.

  • Upgraded a forum from phpBB 3.0.14 to 3.2.2. After the upgrade, I could not show the index until I increased PHP’s max_execution_time by editing the forum’s .htaccess file. Installing my digests extension did not work, perhaps due to issues with bringing over data from the digests mod that was installed. Importing digests from phpBB 3.0 has been pretty extensively tested, so I’m not sure what the issue was. I ended up going into the database and correcting various tables and effectively installing and enabling it that way. I recommended installing reCaptcha as a spambot countermeasure.
  • A client was having trouble with WordPress shopping cart tied to PayPal. An email notification by the shopping cart was getting forwarded to a bunch of email addresses. Apparently the email address was set to forward all email it got to a number of other address. Changing the forwarder fixed the problem.
  • Updated a forum from phpBB 3.2.1 to 3.2.2. Uploaded a freshened prosilver_se style and Danish and German casual honorifics language packs. Updated Tapatalk plugin to version 2.0.7. Reapplying style changes required changes to both prosilver and prosilver_se. Later, I fixed an issue of an inability to attach pictures to posts by simply purging cache. Later, I configured the reCaptcha spambot countermeasure due to bounced emails being received. I suggested changing the user registration settings to user activation by email.
  • First I did some troubleshooting. A phpBB 3.0.8 forum could not display certain pages because PHP Notices kept coming up. Trying to edit these out with error_reporting statements did not work for some reason. There were some odd issues with the host too, such as it would not report which version of PHP was installed. Client eventually authorized an upgrade. The FTP credentials provided did not work, so I ended up creating two FTP accounts until one of them worked. This allowed me to upload a new version of phpBB. The upgrade succeeded after fixing an issue in the database of no active style. The preferred AcidTech style did not work with the large rotating images the client wanted places. So I tried a couple of other styles. We settled on a black/green ne-blackgreen style. I had to integrate client’s in-house ad rotatator program so a number of images would rotate in the header. I made some style changes, mostly to remove gradient images that were messing up the placement of the navigation bar. I added the Advertisement Management extension. I placed a PayPal donate button at the top. Integrating a Google Adsense ad did not work. I used the old code but think it’s too old as it was used inside a table. I did some extra work to put two other ads next to each other with different sizes. Changed max-width of the content area from 900 pixels to 90%. Later, I installed Tapatalk extension version 2.0.7.
  • Client moved the database and files for his forum to a new host, just needed me to finish up the work. I could not connect to the forum after changing the config.php file to point to the new database. This was because PHP 7 was being used and phpBB 3.1 uses mysql_connect, which does not exist in PHP 7. No matter. Uploaded phpBB 3.2.2 and the database update worked fine. I replaced the logo. I removed dead ACP modules. Later, I discovered I apparently I upgraded the wrong database (an older version of the forum), so changed config.php to point to the correct database and upgraded that with no issues.
  • Troubleshooting on a phpBB 3.0 forum. Database exceeded it’s quota of 1GB. The issue was a tapatalk_push_data table, which had 779MB of data in it. I truncated the table. I recommended updating the mod as it seems to be a bug or moving to phpBB 3.2 or rehosting.
  • Clicking on some thumbnails did not bring up the larger image. It appears there were some lost images due to a RAID failure in 2016. Some files in the files folder showed 0 byte length. Some files did not exist. I could not find a backup of these images. So I wrote a script to sort of fix the issue by making the thumbnails the actual photo: changing the filesize attribute in the attachment table to the thumbnail’s size and making the thumbnail column 0. In 88 cases the thumbnail files did not exist either. Provided client with a screen capture of all these abnormalities so he can decide if he wants to delete or edit these posts.
  • In part one of a two part job, I upgraded forum from phpBB 3.0.4 to 3.2.2. Since the forum was integrated into a larger commercial site, I did an extensive analysis of what would be lost with an upgrade. There were many code insertions into phpBB to do some things unique to the business. With the new architecture, this should not be done, but there were no extensions to do the previous functionality. Much of it revolved around a “Get a quote” service. The best i could suggest was to allow these installers to have standard signature lines that would embed this information and link to their referral program. Once we agreed on all the workarounds, I started off with upgrading the less trafficked site as the first test. I applied the AllanSubsilver style. I made some CSS and template changes to accommodate site heading and Google site search, changed some colors, changed some container widths, and address some font issues. I installed and configured the Google Analytics extension. I installed the Advertisement Management extension but did not add any ads at this time. I demonstrated the Get a Quote feature in a signature line. I removed contact information from view topic screen by hiding it. I did various other tweaks. I added the announcement on index extension. I configured reCaptcha and removed thousands of bogus registration and spam posts that quickly accumulated when the forum went live. I suggested they might want to use Cleantalk extension and service. Later I addressed a reCaptcha issue of the CAPTCHA image not showing upping PHP from 5.4 to 5.6. It turned out though that there was some other PHP software on the site that could not use PHP 5.4. PHP was reverted to 5.4. I found a setting in Plesk to set allow_url_fopen to on and the issue went away. More than a week later, I did part two (second domain). A lot of the work was the same as the first part, so it went somewhat faster since I knew what the issues were. Header was different with dynamic content scripts I could not integrate, so I copied/pasted the resulting code. Installed same extensions. Configured reCaptcha. Hid logo block entirely since that was the way it was on the old forum. Did not put fuzzy image along borders of main content area to match what was there before. Changed PHP to allow it to open external links. Changed script for main site to not retrieve a block of recent topics since the database schema had major differences. Likely more tweaks to come in April to close off this project.
  • I upgraded a forum from phpBB 3.1.10 to 3.2.2. Client has a ton of extensions. He decided to upgrade those himself and just have me do the upgrade. The style for Platinum for phpBB 3.2 was not official and I found issues when I installed it. For example, navbar.html did not have logoff and other links! So copied and pasted the version from prosilver and used that and it worked with the old style.
  • I finished an update/upgrade the client started but failed. I could not login to forum with credentials given. I could not use FTP with credentials given either, but was able to create some in cPanel. I tried a few obvious things to get the upgrade/update to finish that did not work. I ended up copying up the entire 3.2.2 source code and it was able to finish the upgrade/update. I placed the logo image using the File Manager editor in cPanel.
  • New install of phpBB on a test server that would eventually be migrated to a production domain. Client wanted to imitate the forum at another website and wanted it put together on the test domain. Some wasted time because I thought he wanted me to imitate his existing website. Most of the work was trying to make the styling acceptable. Client selected the AllenSUBSILVER style. I installed the Advertisement Management extension and placed a sample ad. I installed Pages extension because client wants a bunch of static pages like Contact, Ads, etc. They have placeholder text. Styling was challenging because I decided to use the navigation bar for his other pages and I had to make it red, but doing this made a lot of text and icons impossible to see. So I had to change CSS for submenus so the desired look was accomplished. 90 minutes of tutoring online followed some days later.
  • After an upgrade I did in February there were dead extensions showing on the Customise tab, extensions that worked in phpBB 3.1 but were not available for 3.2. I fixed the by deleting these rows in the phpbb_ext table using phpMyAdmin. Client asked if there were ways to improve performance. I suggested upgrading PHP to 7.2.
  • More work for a client I helped in February. He had weird database permissions issues which caused certain extensions not to install. He moved the forum to a different server, and that seems to have solved previous database permissions issues. Basically the people on this site like lots of features, and wanted me to install a boatload of extensions, many of which were problematic because they were in development, beta, etc. After being assured that I would be paid for extensions I installed that might not work on phpBB 3.2, I ended up installing a total of twelve extensions, some of which as I expected had issues and were subsequently disabled.
  • Upgraded a forum from phpBB 3.0.10 to 3.3.2. Installed Revolution style but tweaked it quite a bit. Background color changed from black to white. Increased minimum widths for content area. Reduced vertical space for logo and content area as it was too generous. Styled the search box to make it look similar to other content areas. Installed reCaptcha V2 as spambot countermeasure.

Site cleanup

I’ve spent the last two days cleaning up the website. Some pages were removed. My services page was broken down into a number of pages for easier reading. I changed some page titles and edited one form. I also updated the theme. Hopefully the site is cleaner, less cluttered and easier to use.

February 2018 work summary

The nature of my business seems to be that it the work is few and far between or it all comes in at once. The first half of the month was mostly quiet. The second half was mostly busy … too busy. Anyhow, here’s a summary of my work in February. As always, I am not identifying my clients:

  • A lot of work here for one client. Basically, the client wanted a whole lot of changes to his forum. The endeavor was sort of successful.
    • I installed a development radio extension. This puts a player on the screen that plays music from a playlist for all members on the forum. I had to tweak the composer.json file to get it to install. To get the radio player images to appear on the portal, I had to hack one of the programs for the extension to use an image path that starts with / or they would not appear on the portal.
    • I tried to install Tapatalk a number of times but to no avail. I kept getting an installer error creating the Tapatalk tables. Upgrading phpBB didn’t work. So I tried installing an earlier version of Tapatalk. That didn’t install either. Since the issue was with the Tapatalk table not being created, I installed Tapatalk on a test environment, got the needed SQL there using phpMyAdmin and recreated it manually on the client’s site in phpMyAdmin. I changed the phpbb_ext table to make it active and cleared the cache. I could then see it in the Extensions tab and could enter the key.
    • Created an Apache redirect so non-www URLs went to www instead. Lines were added to .htaccess file.
    • Changed the color of the text in mChat when editing chat text. It was white on white, made it black on white.
    • Added a favicon for the site
    • Installed an extension to open external links in new tabs
    • Installed the Profile Flair extension. This allows badges to be created.
    • Installed the YouTube Video Gallery extension. It requires creating an application in Google console to enable, which the client did.
    • Updated phpBB 3.2.1 to 3.2.2. Applied three manual changes afterward, bugs that were subsequently found in the release.
    • Edited some colors on the portal sidebar that kept text from being seen.
    • Fixed a resizing issue with embedded videos on mobile devices by adding max-width:100% and max-width:100% CSS directives for the object tag.
    • Made more tweaks to colors for the “time” line near the navigation bar, made better CSS selectors for poll links in the portal and moved vote buttons in the portal more to the right, along with vote totals.
    • Radio extension turned out not to be viable. So I disabled it. I tried to place the player manually. I tried a number of approaches, once I figured out how to write the Javascript correctly. The easiest way was to turn it into an ad in the Advertisement Management extension and place it above the navigation bar.
    • More trouble with Tapatalk when the client tried to add a permanent Tapatalk key. Again the extension failed in an ugly manner and again the issue was some sort of database privilege that should have been there was not, probably for creating new objects like tables, columns and indexes. I commented out some code in the extension to get it to come up so the board was usable, but feels jury rigged. Installed some smilies that client needs to configure. The client is getting with his web host to try to solve the underlying issues of database privileges needed to create new tables that seems to be the issue with Tapatalk.
  • I upgraded forum from phpBB 3.0.10 to 3.2.2. I applied patches to 3.2.2 after the upgrade. There were two issues during the upgrade. The first (duplicate row in config table) went away by running the upgrade again. The second required using phpMyAdmin to edit the prosilver style and make it active. Then the upgraded completed. I removed some dead modules carried over from phpBB 3.0. I created keys on reCaptcha site and entered them into reCaptcha spambot settings, but they were not recognized. I eventually discovered if I requested invisible reCaptcha those keys would work. There was a similar issue with a Cleantalk authorization key. The client had to generate a key on Cleantalk site and he installed it himself. I also installed the Advanced BBCode extension. I noted an email error I encountered with the upgrade. It may be an issue with integration with email. Later that day when the client removed my FTP account (since it gave access to the web root) it also removed everything in the public_html folder! So his whole web site including the forum was gone! The web host had to recover it. The next day I reapplied the file changes for the upgrade and uploaded the programs for the extensions that were installed. The database was still good so I didn’t need to run the upgrade program again. The client asked me to look into errors in some 3rd party software tied to phpBB in his members folder. It asked for PHP 5.4. I changed his .htaccess file but that exposed an issue that the code was using super globals, so it didn’t work. I suggested contacting the original author and having him update the program to use the new phpBB 3.2 libraries. Client eventually figured it out himself.
  • Lots of work for this client too:
    • I converted a forum from phpBB 2.0.23 to 3.2.2. About 200,000 posts with about 7000 attachments. The conversion went smoothly. Allen Subsilver style installed. I replaced the logo. I recreated search index. I moved the old forum into old_forum folder where it exists as an archive.
    • Later I installed a Board Rules extension and Custom Registration Agreement extension.
    • Customer discovered a weird problem. When using the search index, sometimes a XML parsing error occurred. After lots of puzzling it through I realized I had seen this before. Non UTF-8 characters (probably belonging to the Windows character set) were in post_text column and other columns. The parser could not parse these characters because they were not translatable into UTF-8. I fixed it with SQL using MySQL CAST and CONVERT functions on all columns in tables where users type in text.
  • Removed and re-place some ads in overall_header.html for a phpBB 3.0 forum
  • I got called in as a consultant for a huge forum, the biggest I’ve ever seen: 14M posts! That’s about 4 times as many posts as are on phpbb.com’s forums which have been running since 2001! What a strange issue they were having! For about 48 hours they could operate as normal, then the database would freeze updating num_posts in the phpbb_config table. All they could do is recover the database and start again, then 48 hours later it would happen again. They were very frustrated. The error message suggested that some transaction was not getting completed. In addition, the value for num_posts in the phpbb_config was not consistent with the actual number of posts. On top of all this, this phpBB 3.0 forum has a site Wiki outside of phpBB, and the Wiki made posts to their forum using a MySQL stored procedure. What to do? It took hours to get command line access just so I could look around. Once inside MySQL I looked at the tables. Most were using the MyISAM storage engine, but the phpbb_config table where the problem was happening was using the InnoDB storage engine. If I changed its storage engine to MyISAM, would the problem go away? I did and the problem went away! Oh, I also wrote some SQL so num_posts matched the actual number of posts in the phpbb_posts table.
  • Upgraded a forum from phpBB 3.2.1 to 3.2.2. No surprises.
  • Updated a forum from phpBB 3.2.0 to 3.2.2. A direct 3.2.0 to 3.2.2 update would not work and caused Symfony errors. After much trial and error an upgrade to 3.2.1 then to 3.2.2 worked. I reapplied the logo and styles. I was asked to set permissions so users could edit their own posts and to fix an issue with their posts not going through moderation. It took some puzzling to figure this out. Apparently when a new user registers, they are placed in both the Newly Registered Users group and the Registered Users group. Unless permissions for Newly Registered Users are set to Never the privileges for Registered Users, if more generous, will take precedence. So for Newly Registered Users, I added Never permissions for seeing forums they weren’t supposed to see. Although newly registered users were required to have one post before they were considered registered users, posts are only moderated if the moderation permission is enabled, which it was not. So I turned on these permissions for this group.

Digests 3.2.6 (not RC13 this time) released

Please see this post for details. You can download the latest version from my digests page or get it here in GitHub.

There’s really no new functionality but it does clean up a few bugs, changes in minor ways the look of some ACP pages (Edit subscribers mostly) and addresses the issues by the last review by the phpBB extensions team. It’s been submitted for review by the extensions team and most likely will get approved.

It took about 6 weeks to get a review last time, so I expect it will take about that long this time too. But maybe since it is reaching a release stage they will expedite the process.

Some pricing changes

I’ve upped some of my prices. You can see a list of all my prices on my services page.

I’m trying to recapture the labor involved in answering your questions prior to you hiring me. Not everyone who inquires of my services hires me of course. Typically there is at least an hour of time involved in back and forth emails with clients. This time was not built into my pricing structure, meaning I am effectively discounting my own labor rates by giving away this time for free.

So mostly this amounts to $10 or $20 increases for services I do most of the time, such as updates, upgrades, conversions and extension installations. My basic labor rate is unchanged. Obviously if you choose not to hire me you don’t have to pay anything. But if you do I want the work I do for you to reflect the full amount of my effort. And that typically involves at least an hour of back and forth communications over email, often more, usually over many days, as details about the work are refined.

My prices remain very competitive. If you can find a better deal out there, please go for it.

I also updated the page to discuss developing extensions for clients. In general I don’t do it, but I will refer you to other extension authors I trust. Mostly it’s due to a lack of time as developing extensions takes considerable time. Extension development is quite costly and most clients usually decide they cannot afford to have custom extensions developed anyhow.

January 2018 work summary

I didn’t do much work in January, mainly because I spent most of it on vacation: 19 days in total! It was a great vacation: a 16 day circuit of the Panama Canal on Holland America, from Fort Lauderdale to San Diego with lots of ports of call. In addition we stayed an extra day in San Diego to see its infamous zoo! I do have a few buns in the oven at the moment including a large project for a large client that I am starting work on that may take a month or two.

During my vacation my site’s certificate expired. I tried to fix the issue remotely when I had Internet, but just couldn’t do it with my Windows laptop. That may have cost me some business. It’s all fixed now.

On the infrastructure side, I upgraded my iMac to use a solid state drive. Things are so much spiffier now!

Before and after my vacation though I did squeeze in some jobs:

  • A client got rid of his forum due to low traffic but wanted me to do some WordPress work for him. He was been having WordPress security issues. I examined his WordPress .htaccess file. I found no issues there but redundant duplicate code was removed. I explained how the .htaccess file works and provided advice on updating, finding, fixing and proactively handling security for WordPress including Wordfence and UpdraftPlug plugins.
  • Two forums were upgraded for the same client, both from phpBB 3.0.12 to 3.2.1. Since the forums caters to German speakers, with the upgrade I installed two German language packs (casual and formal honorifics). On the first forum, I installed the prosilver_se style. I installed the Navbar search extension thinking it would help with styling but eventually disabled it as it was not needed. I changed style a bit to somewhat match old logo and background, experimenting with CSS until I found something that fit. Since the user could not login, I created a new account (after enabling registration) and gave myself founder privileges in the database. The next day I upgraded the second forum. I integrating the old logo but it did not look right with the new style. I tried changing the background color for the style but it still looked off. However, it was acceptable to the client. I then installed version 3.2.6 of my digest extension, and set up and tested the system cron job to ensure digests went out in the hour requested. I used curl and set the cron to run at top of the hour. I resolved a permissions issue that allowed any registered user to be a global moderator. There were some hosting issues: I could not find a link to cron in the web host control panel until the customer added it to my account. The next day I fixed a database issue: changed default for user_topic_sortby_type from m to t. This was apparently changed by some phpBB 3.0 mod. I updated the database to change this value to t for all users.
  • Troubleshooting. A forum gave a “is_dynamic missing” error message, which was actually a row in the phpbb config table. It took a bit of puzzling but it turned out that the forum’s config.php file was pointing to a phpBB2 database! No wonder the row was missing! I searched and found another database that looked like it had the tables for phpBB 3. But it was missing the last 5 tables. I found a copy of the database in the store folder dated 12-18-17. With customer’s permission, I reloaded that database. Bringing up board, the phpbb_login_attempts table was missing so I created it manually. I could not login with customer’s credentials so I created an account for myself and gave myself founder privileges via the database. The subsilver2 style was misidentified as Red Silver. I renamed it to subsilver2 in the database and enabled the Red Silver style. This fixed the styling issue and the site’s logo appeared in the header like before.
  • I upgraded a forum from phpBB 3.2.1 to 3.2.2. An issue with quoted characters repeating themselves horizontally and vertically, overwriting the quote, was solved with upgrade. Replicated logo in header and changes to footer. This was my first attempt to update to phpBB 3.2.2. I quickly learned that (a) the incremental update still does not work reliably and (b) you need to apply some patches. Other than that (to quote Monty Python), phpBB was perfectly fine!
  • I upgraded another forum from phpBB 3.2.1 to 3.2.2. Database updater failed due to timeout. The real issue were some bugs in 3.2.2 and had to apply some patches to complete the upgrade. I reapplied the logo. The search index erroneously pointed to nonexistent MySQL index. Pointed it to phpBB native and message went away.

End phpBB update styling rework with a custom style

Updated February 15, 2018 to add a few things.

Has this happened to you? You update phpBB to the latest version and find out that your custom logo or various style changes that you tediously made to phpBB are gone, or partially gone. It’s a common problem and one reason many forum owners defer updating phpBB.

You can end this hassle by creating and installing your own custom style. Using this approach your custom style inherits most of its styling from a primary phpBB style. You then selectively override the primary style’s CSS, HTML or Javascript with your own changes. This way when the primary style you use is changed, you don’t lose your custom changes. This also ensures that your styles and templates use the most current and approved code, which often includes security patches.

In this tutorial I will show how you can do this. I will keep my example simple by using my custom style to swap out the default phpBB logo with my own logo, sized to the new logo’s dimensions. In principle though you can go way beyond this simple use. For example, your custom style can overwrite the inherited style’s colors, padding and margins, or container widths and heights. You can also overwrite HTML and Javascript files.

Overview of steps required

The basic approach is:

  1. Make a note of all the changes you made to your style
  2. Reload your preferred style
  3. Create a custom style that inherits from your preferred style
  4. Override the preferred style’s stylesheet directives. This is best done by creating a stylesheet.css file for your custom style and placing your style customizations there.
  5. If you changed some templates, place the custom version of these templates in your custom style’s template directory. Frequently, forum owners will make changes to overall_header.html and overall_footer.html.
  6. Install the custom style
  7. Make the custom style the primary style
  8. Test and refine

Let’s delve into each step to see how this is done.

Make a note of all the changes you made to your style

You probably know what these changes are, but if you have any questions you can use a file comparison tool like WinMerge (for Windows) or kdiff3 (for pretty much any operating system) to compare your files with a reference version.

  1. Download your current style folder where you made all your custom changes, such as /styles/prosilver
  2. Download a reference version of your style for your current release of phpBB. phpBB keeps a list of its releases here. If your styles are based on prosilver then you would use the reference /styles/prosilver folder for your current release of phpBB. If using a different style, find the style version you used. You may have to download it from phpbb.com or from the style author’s website.
  3. Run the file comparison tool and note the changes you made so they can be reapplied in the custom style.

Reload your preferred style

  1. Make certain you have documented all the changes you made to your style. Once they are overwritten, you may not be able to recover them.
  2. Since you made changes to your preferred style, it’s a good time to undo them. The simplest way to upload the reference version of your style, replacing anything that’s there. Purge the cache. If you don’t see the style changes afterward, clear your browser’s cache and reload the page.

Create a custom style that inherits from your preferred style

  1. First review phpBB’s Creating & Modifying Styles page.
  2. Create a folder in the styles folder for the name of your style. In this example I keep it simple and call the folder “custom”, i.e. /styles/custom.
  3. Create a style.cfg file in this folder. Copy the style.cfg contents from your parent style’s style.cfg file. Below is the code in /styles/prosilver/style.cfg for phpBB 3.2, which I used because my “custom” style inherits from prosilver.
#
# phpBB Style Configuration File
#
# This file is part of the phpBB Forum Software package.
#
# @copyright (c) phpBB Limited <https://www.phpbb.com>
# @license GNU General Public License, version 2 (GPL-2.0)
#
# For full copyright and license information, please see
# the docs/CREDITS.txt file.
#
# At the left is the name, please do not change this
# At the right the value is entered
#
# Values get trimmed, if you want to add a space in front or at the end of
# the value, then enclose the value with single or double quotes.
# Single and double quotes do not need to be escaped.
#
#

# General Information about this style
name = prosilver
copyright = © phpBB Limited, 2007
style_version = 3.2.0
phpbb_version = 3.2.0

# Defining a different template bitfield
# template_bitfield = lNg=

# Parent style
# Set value to empty or to this style's name
# if this style does not have a parent style
parent = prosilver
  1. In my example I changed “name = prosilver” to “name = custom”. Since I want to inherit from prosilver I left the “parent = prosilver” line unchanged. If you are changing a style other than prosilver as the primary style, you need to change the parent style to the correct style name. It must match the parent folder name in the styles folder. You might also want to edit the copyright, style_version and phpbb_version lines. If it’s only for your own use, this is not necessary. Here are my changes:
# General Information about this style
name = custom
copyright = © Mark D. Hamill
style_version = 1.0.0
phpbb_version = 3.2.2

# Defining a different template bitfield
# template_bitfield = lNg=

# Parent style
# Set value to empty or to this style's name
# if this style does not have a parent style
parent = prosilver
  1. Save the file, making sure it is in the root folder for the custom style, e.g.: /styles/custom/style.cfg.

Override the preferred style’s stylesheet directives

  1. Create a theme folder for your style. In my example, this would be /styles/custom/theme.
  2. Create an images folder inside the theme folder. In my example, this would be /styles/custom/theme/images.
  3. If changing the logo, upload the logo you will use to /styles/custom/theme/images. Make a note of the image’s height and width as you will need this later.
  4. Create a file called stylesheet.css in the theme folder.
  5. To inherit styles from your parent style, you need an @import statement at the top of this file. For example, if prosilver is the preferred style, this line would be at the top of the file. Generally you just need to reference the stylesheet.css file in the parent style. You will have to amend the path so it finds the parent style’s stylesheet files. In my case for the @import line, I added “../../prosilver/theme/”. The ?v=3.2 indicates the version of phpBB expected, so it may have to be changed.
@import url("../../prosilver/theme/stylesheet.css?v=3.2");
  1. Any style changes that you want to override should now be appended to the end of this file. In the example of replacing the logo, in the prosilver style you would normally edit the .site_logo class in colours.css and common.css. In my case I added these lines at the end of my /styles/custom/theme/stylesheet.css file, which provides the correct image to use for the logo and its proper dimensions:
.site_logo {
    background-image: url("./images/mark.jpg");
    width: 181px;
    height: 229px;
}
  1. I then saved the file stylesheet.css with my changes.

Changing templates

In my example, since I am only replacing the logo so no template changes were needed. If you need to change templates there are two approaches.

  1. The simplest is to copy the template, for example, /styles/prosilver/template/overall_header.html to /styles/custom/template/overall_header.html. Then make the changes that you need to make and save the file. This has a downside: if there are changes made to this template with an update, your version won’t have them unless you manually inspect for any changes and apply them to your custom version.
  2. In many cases you want to insert some HTML or Javascript rather than change existing HTML or Javascript. In this case it’s better to use template events, if you can “hook into” an appropriate event. This way if the parent style is changed with an update, you don’t have to worry about replicating any changes to it in your style. For example, overall_header.html has a template event in it marked as <!– EVENT overall_header_head_append –>. In this case you could create an event folder in your template folder then create a file called /styles/custom/template/event/overall_header_head_append.html. Add whatever HTML you want inserted when this event is encountered into this file. A list of template events can be found here.

Install the custom style

  1. ACP > Customise > Style management > Install Styles
  2. Select the new style you created (“custom” in my example) by pressing the corresponding Install style link.

Make the custom style the primary style

ACP > General > Board configuration > Board settings. Generally you set the default style to your new custom style, the guest style to your new custom style and you may optionally want to set the override user style option to Yes. Submit the form.

Test and refine

You should not need to purge the cache if you make any stylesheet changes. However, if you make subsequent changes to any templates first purge the cache then test.

Approach when upgrading

This approach is unlikely to work correctly when upgrading. An upgrade is when you go from one minor release of phpBB to another, such as from 3.2 to 3.3. You can of course go through the process of creating a new custom style again. As for updates, this should work.

Enjoy!

December 2017 work summary

December was a very slow month. December often is as clients have other priorities as did I. I finished teaching a class and issues two new releases of my digests extension. Revenue-wise, 2017 was my best year so far. Here is a summary of my paid work in December. All client information has been anonymized. Since I will be on vacation for 18 days in January, I expect next month will be slow as well.

  • Undertook a painful upgrade of a forum from phpBB 3.0.1 to 3.2.1. It ended up taking most of the day. A database timeout meant I could not upgrade phpBB on the client’s site. So I had to extract the database, download it, recreate it on my machine and convert it there. Some tables requires multiple extracts to export due to timeouts. Because I have PHP 7 on my main computer and I needed to first upgrade the forum to phpBB 3.0.14 (which does not work on PHP 7), I had to do the conversion on my laptop. After I upgraded the forum on my laptop, extracting the database from the laptop turned out to be an issue until I explicitly told mysqldump to export as UTF 8 (UTF-16 was the default). This seems to be a MySQL peculiarity when it runs on Windows. In addition, the client’s file manager was rudimentary. All files had to move using FTP. Installed the Advertising Management extension and mChat extension but left client to configure. Client will handle styling. Upgraded PHP to 5.6 (was on 5.0).
  • Moved a forum from Westhost hosting to A2 hosting. Client had a temporary domain name on the new host. I first tried to upgrade forum on old server but it didn’t work. I created a new forum on new server but database and files were not moved by the new host. Client provided a copy of the database. I loaded it on local machine (3.1.9 database) and upgraded it there to 3.2.1. I then created a new forum database on new host. I populated it with upgraded database from my machine. I changed folder permissions to standard. Moved /files, /images and /store folders from old server. Changed Imagemagick path as it had changed so embedded images would display. Installed ID_Launch Fresh Style. Installed Google Analytics and Shareon extensions.
  • Installed Authorized for URLs extension. I went through the client’s numerous user groups and disabled privilege for bots, guests and newly registered users. I enabled extension to work for every other group. I provided instructions for its use.
  • Troubleshooting. Slow server, mostly manifested in slow database but also a lot of spam traffic. I discovered a WordPress temporary table issue. Two search tables in phpBB had repair issues as well; repairs would not stick for long. To keep a lot of the spam traffic from ever reaching the server, I installed Tapatalk both for WordPress and phpBB and enabled its spam firewall feature. I changed the storage engine for forum tables to use InnoDB. Converting the search tables to InnoDB required doing it from the command line as phpMyAdmin would time out.
  • Issue with routing and mChat on other than first page of the mChat display. Not sure what was causing issue is. .htaccess file for forum was missing uploaded it but didn’t solve the issue. Suggested disabling mod_rewrite. Installed SEO Sitemap extension and Italian language translation for it.