Knowledge Base

Notice:
Following phpBB2's EoL, this article is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Re-install / Update phpBB2
Article ID: 91
Written By: Vic D'Elfant
Written On: Wed Jun 20, 2007 8:35 am
Description: This article explains how to update or reinstall your phpBB board while keeping all data (thus the SQL database) intact
link to this article on phpbb.com: Select All
[kb=re-install+update-phpbb2]Re-install / Update phpBB2[/kb]
link to this article on your own board: Select All
[url=http://www.phpbb.com/kb/article/re-install+update-phpbb2/]Knowledge Base - Re-install / Update phpBB2[/url]

Backing up
  • Before applying any of the changes described in this article, you should first backup your complete database (structure and data). The best way to do this is by using phpMyAdmin, a database administration tool which most paid hosts have preinstalled. You'll have to contact your host to find out if they have it preinstalled and if so, where you can find it.
  • The following Knowledge Base articles explain how to backup your database using different methods – my opinion is that it would be unnecessary to explain the exact same steps in this article.
Things you should know
  • In case you are upgrading from a version which had security exploits in it you should check for any suspicious files. Check all directories, especially the template directories (/templates/subSilver/images etc.).
    If you're unsure if a file belongs to the stock phpBB files or not, post at the Support Forum and someone will be able to tell you whether it's safe to leave the file in place or not
  • After applying the update you should check if registering, moderating, etc. is still working before going back live
  • This manual describes two different upgrade situations: with MODs installed, and without MODs installed. If you are unsure whether or not you have MODs installed at your board, you should follow the steps describing how to upgrade with MODs.
    If you fail to do so and you did have MODs installed at your board you'll get problems for sure.
  • Note for SQL queries mentioned in this article: substitute phpbb_ with the table prefix you set during the phpBB installation
  • If you encounter problems after upgrading from a previous version, you can ask for help at the phpBB.com Support Forums. A team member or anyone else will be more then happy to help you out. However don't forget to fill out the Support Request Template, so the person helping you will be able to see where you were upgrading from, if you had any MODs installed, etc.
Update
  • Before starting with updating, you should first disable your board to prevent problems while updating. To do so you'll have to go to your board's admin panel, click Configuration in the navigation panel, and set 'Disable board' to True. Then click OK to confirm the changes.
  • If you have MODs installed

    There are two ways of updating your board in case you have MODs installed (or modified the script files of your board in any other way)
    • .patch files
    • Unix users: to use this way of upgrading you will need command line access to a standard UNIX type patch application
    • Windows users: there also is a Win32 version of the patch tool available, which allows you to run patch files on Windows. You can download it here. Two topics at phpBB.com describe some minor problems which users encountered while using the patch tool: How to apply a patch on windows?, and [RESOLVED] Patching Problem.
      1. Download the “Patch file only” package from the phpBB.com download page, and extract it to a folder somewhere at your hard drive
      2. Select the correct patch, e.g. if your current version is 2.0.14 you need the phpBB-2.0.14_to_2.0.19.patch. Place the correct patch in the parent directory of your board (the one containing the phpBB core files like index.php, viewforum.php, etc.)
      3. Upload the update_to_latest.php file to the /install directory of your board. If the directory doesn't exist you'll have to create it
      4. Step 4
        Run the following command using the command line:
        Code: Select all
        patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME]

        where PHPBB DIRECTORY is the directory name your phpBB board resides in and where PATCH NAME is the filename of the patch file which you would like to execute.
        Note: When executing, don't type in the brackets
        This should complete quickly, hopefully without any HUNK FAILED comments.

        If you do get failures you'll have to try the next update method described in this article. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source
      5. Delete the patch file (or files)
      6. Run install/update_to_latest.php trough your browser (using http://www.domain.com/phpBB2/install/up ... latest.php, for example)
        This will update your database schema and data (if appropriate) and increment the version number
      7. Delete the /install directory from your board's root directory
    • Code Changes MODs
      The code changes are also available in MOD-format, here: http://sourceforge.net/project/showfile ... up_id=7885. This is particularly useful if you don't have command line access to your host, and if you have EasyMOD installed. Of course you can apply the changes by hand, but EasyMOD will do it in less then a minute
    • When using the MOD files you'll have to upgrade version after version, e.g. if you're currently running phpBB 2.0.15 and you want to upgrade to phpBB 2.0.19, you'll have to execute the 2.0.15 to 2.0.16 MOD, then the 2.0.16 to 2.0.17 MOD, then the 2.0.17 to 2.0.18 MOD, and finally the 2.0.19 MOD.
    • Okay, let's get to the actual updating (I assume that you're using EasyMOD for this):
      1. Download the zip file containing the Code Changes of the version from which you're upgrading, and unzip it to a folder at your hard drive.
      2. You'll see a bunch of files; the ones we need to concentrate on are phpbb_2.0.xx_to_2.0.xx.txt and update_to_latest.php (replace the xx with the version number you're upgrading to/from).
      3. Upload the phpbb_2.0.xx_to_2.0.xx.txt file and any other .php files except for update_to_20xx.php to /admin/mods/phpbb_20xx_to_20xx (replace the xx with the version number you're upgrading to/from).
      4. Go to the EasyMOD control panel in your ACP, and install the MOD. If everything works well you should get no error messages at all. If you do get error messages you'll have two options: ask in the support topic of the Code Changes MOD which you're trying to execute for help, or reinstall – but you'll have to keep in mind that you'll have to add all MODs again. How to reinstall phpBB without loosing your data is explained in the next section in this article.
      5. Upload the update_to_latest.php file to the /install directory of your board. If the directory doesn't exist you'll have to create it
      6. Run install/update_to_latest.php trough your browser (using http://www.domain.com/phpBB2/install/up ... latest.php, for example)
        This will update your database schema and data (if appropriate) and increment the version number
      7. Delete the /install directory from your board's root directory
      • If you have no MODs installed
        1. Download the “Changed Files Only” from the download page at phpBB.com, and unzip it to a directory at your hard drive
        2. Inside of this zip you'll see several more zip files. Unzip the one that refers to the version you're updating
        3. Upload all those files, while overwriting all old ones. You should also upload the /install and /contrib directory which can be found in the main zip file (phpBB-2.0.xx-files.zip)
        4. Run /install/update_to_latest.php trough your browser, using http://www.domain.com/phpBB/install/upd ... latest.php, for example
        5. Delete the /contrib and /install directories from your server
      Reinstall
      • This section of the article will explain how to reinstall your board without loosing any so-called 'dynamic' data (like posts, users, topics, forums, groups, etc), as well as avatars.
      • A clean install is the best way to start all over again in case you encounter severe problems with MODs, upgrading, or simply if you want to start with fresh files again.
        1. Download the /images/avatars directory and its subdirectories to a folder at your hard drive, while keeping the directory structure intact. Also download the file called "config.php", which can be found in your forum's root directory
        2. Next thing we should do is clean the SQL database from all tables or fields which have been created by MODs. If we won't remove those fields or tables, you would get problems if you would reinstall any of the MODs.
          To do so you can use a script which I wrote; we'll download it in the next step
        3. Download the 'clean tables' script here. Note that this script will
        4. Create a directory called 'install' in your forum's root, and upload the .php file into it. only work with MySQL
        5. Open the script by visiting it with your browser, using http://www.domain.com/forum/install/clean_tables.php. The script will display a list with all fields and tables which don't belong to a default phpBB install, and are probably created by MODs. Make sure that you double-check that no valuable fields or tables will be dropped, and click the 'Clean tables' button to actually drop the selected fields and tables.
          Again, note that it is entirely your own responsibility to create a backup of your database before running the script
        6. Rename your forum file's directory to another name, for instance forum2. This way you won't have to download all forum files if you want to keep a backup. You can delete this directory if everything is working like it should after the reinstallation.
        7. Re-create the directory which your forum used in the past
        8. Download the 'Full package' from the phpBB.com download page, and upload its content to the directory you created above
        9. Re-install phpBB, but use 'temp_' as the 'table prefix'. Doing so will prevent phpBB from overwriting your current SQL data, or coming up with a bunch of error messages
        10. Get to phpMyAdmin (ask your hosting provider where to find it) – we'll have to move some template tables over and delete the temp_ tables which phpBB created when re-installing
        11. Select the correct database using the combo box element on the left
        12. Click the SQL tab on the right
        13. Execute the following code:
          Code: Select all
          DROP TABLE phpbb_themes;
          DROP TABLE phpbb_themes_name;
          RENAME TABLE temp_themes TO phpbb_themes;
          RENAME TABLE temp_themes_name TO phpbb_themes_name;
          UPDATE phpbb_users SET user_style = 1;
          UPDATE phpbb_config SET config_value = '1' WHERE config_name = 'default_style';
          DROP TABLE temp_auth_access;
          DROP TABLE temp_banlist;
          DROP TABLE temp_categories;
          DROP TABLE temp_config;
          DROP TABLE temp_confirm;
          DROP TABLE temp_disallow;
          DROP TABLE temp_forums;
          DROP TABLE temp_groups;
          DROP TABLE temp_posts;
          DROP TABLE temp_posts_text;
          DROP TABLE temp_privmsgs;
          DROP TABLE temp_privmsgs_text;
          DROP TABLE temp_forum_prune;
          DROP TABLE temp_ranks;
          DROP TABLE temp_search_results;
          DROP TABLE temp_search_wordlist;
          DROP TABLE temp_search_wordmatch;
          DROP TABLE temp_sessions;
          DROP TABLE temp_smilies;
          DROP TABLE temp_topics;
          DROP TABLE temp_topics_watch;
          DROP TABLE temp_user_group;
          DROP TABLE temp_users;
          DROP TABLE temp_words;
          DROP TABLE temp_vote_desc;
          DROP TABLE temp_vote_results;
          DROP TABLE temp_vote_voters;
        14. Put the config.php file which you downloaded in Step 1 back into the forum's root, while overwriting the one which is already present. phpBB will now connect to your SQL server using the login details and table prefix which were used in the past
        15. Upload the /images/avatars directory back onto your server
        16. Run install/update_to_latest.php trough your browser (using http://www.domain.com/phpBB2/install/up ... latest.php, for example). This will update your version number and (if appropriate) alter your database schema.
        17. Delete both the /contrib and /install directory