PHP Bulletin Board Home
News About Home
Features of phpBB Test drive phpBB Downloads Support for phpBB The phpBB Community Styles for customising phpBB 3rd party modifications to phpBB

Support Home | Knowledge Base Home | Submit Article | Search Articles | Browse Articles
 Re-install / Update phpBB 
Description: This article explains how to update or reinstall your phpBB board while keeping all data (thus the SQL database) intact
Author: Vic D'Elfant
Date: Tue Dec 21, 2004 7:54 pm
Type: HowTo
Keywords: upgrade, upgrading, reinstall, reinstalling, re-install, re-installing, update, updating
Category: Installing/upgrading/converting
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.

        Step 1
        Download the “Patch file only” package from the phpBB.com download page, and extract it to a folder somewhere at your hard drive

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

        Step 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

        Step 4
        Run the following command using the command line:
        Code:
        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

        Step 5
        Delete the patch file (or files)

        Step 6
        Run install/update_to_latest.php trough your browser (using http://www.domain.com/phpBB2/install/update_to_latest.php, for example)
        This will update your database schema and data (if appropriate) and increment the version number

        Step 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://www.phpbb.com/phpBB/catdb.php?cat=48. 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 Wink

        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):

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

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

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

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

        Step 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

        Step 6
        Run install/update_to_latest.php trough your browser (using http://www.domain.com/phpBB2/install/update_to_latest.php, for example)
        This will update your database schema and data (if appropriate) and increment the version number

        Step 7
        Delete the /install directory from your board's root directory


    If you have no MODs installed
      Step 1
      Download the “Changed Files Only” from the download page at phpBB.com, and unzip it to a directory at your hard drive

      Step 2
      Inside of this zip you'll see several more zip files. Unzip the one that refers to the version you're updating

      Step 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)

      Step 4
      Run /install/update_to_latest.php trough your browser, using www.domain.com/phpBB/install/update_to_latest.php, for example

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

    Step 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

    Step 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

    Step 2a
    Download the 'clean tables' script here. Note that this script will only work with MySQL

    Step 2b
    Create a directory called 'install' in your forum's root, and upload the .php file into it.

    Step 2c
    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

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

    Step 4
    Re-create the directory which your forum used in the past

    Step 5
    Download the 'Full package' from the phpBB.com download page, and upload its content to the directory you created above

    Step 6
    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

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

    Step 7a
    Select the correct database using the combo box element on the left

    Step 7b
    Click the SQL tab on the right

    Step 7c
    Execute the following code:
    Code:
    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;


    Step 8
    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

    Step 9
    Upload the /images/avatars directory back onto your server

    Step 10
    Run install/update_to_latest.php trough your browser (using http://www.domain.com/phpBB2/install/update_to_latest.php, for example). This will update your version number and (if appropriate) alter your database schema.

    Step 11
    Delete both the /contrib and /install directory


You're done!

Revisions
1109134187 - Updated for 2.0.12 - AdamR
1109577960 - Updated for 2.0.13 - Vic
1113645423 - Updated for 2.0.14 - Vic
1115550676 - Updated for 2.0.15 - Vic
1118223333 - Made minor change, as suggested by DavidKelley
1119896541 - Updated for 2.0.16 - Vic
1121965645 - Updated for 2.0.17 - AdamR
1131177399 - Updated for 2.0.18 - Anon
1136232273 - Updated for 2.0.19 - AdamR

Username: Password:
News | Features | Demo | Downloads | Support | Community | Styles | Mods | Links | Merchandise | About | Home
 © Copyright 2002 The phpBB Group.