# SMF 2.0 Upgrade Guide

## Upgrading your forum

Thank you for deciding to upgrade to SMF. Before you get started, please remember that there is a place for help at www.simplemachines.org if you run into any problems at all.

You can find the following information in this file:

- » Minimum installation requirements
- » Backing up data
- » Upload files method 1: using FTP
- » Set file permissions
- » Run the upgrading tool
- » Upload files method 2: using webinstall.php
- » Finishing the upgrade and cleaning up

## Minimum installation requirements

Your server must meet a few requirements to be able to run SMF. If you are unsure as to whether your webserver meets these, please try to upgrade anyway - it should detect any problems.

- Any webserver that properly supports PHP, such as Apache or Internet Information Services (IIS).
- PHP 4.1.0 or higher. The following directives are required to be set correctly in php.ini:
  - the engine directive must be On.
  - the magic_quotes_sybase directive must be set to Off.
  - the session.save_path directive must be set to a valid directory.
  - the file_uploads directive must be On.
  - the upload_tmp_dir must be set to a valid directory.
- Any of the following database systems
  - MySQL 4.0.18 or higher.
  - PostgreSQL 8.0 or higher.
  - SQLite 1.x - 2.x.
- at least 2 megabytes of storage space in the database, although more is highly recommended.
- The database user must have at least the following privileges: SELECT, INSERT, UPDATE, DELETE, ALTER, and INDEX.
- about 20 megabytes of storage space on the web server, although more is recommended.

Recommendations for best performance:

- Windows, Linux or another Unix based operating system.
- the GNU Aspell 0.50 or higher and its dictionaries for spell checking functionality.
- Apache 2.0.0 or higher with AcceptPathInfo set to On (Apache 2 and later only) for queryless URL support.
- PHP 5.2.0 or higher, with the following set in php.ini:
  - the max_input_time directive is set to a value of at least 30.
  - the post_max_size and upload_max_filesize directives set to the size of the largest attachments you wish to be able to upload.
  - the session.use_trans_sid directive set to Off.
  - the memory_limit directive is set to at least 8M.
  - the max_execution_time directive is set to at least 15.
  - the register_globals directive is set to Off.
  - the safe mode disabled or suEXEC ensabled.
  - the BCMath library enabled for using the OpenID registration method.
- Any of the following database systems
  - MySQL 5.0 or higher.
  - PostgreSQL 8.3.3 or higher.
  - SQLite 2.8.
- GD Graphics Library 2.0 or higher.

If your server does not meet these requirements, SMF may not work properly.

## Backing up data

Before starting the upgrade process, a backup of the live database should be taken. This protects the forum from accidental damage and any issues from upgrading. Although all steps are taken, and extensive testing carried out, sometimes issues develop. Therefore, having a backup is crucial. The upgrading tool can backup all database tables before it runs, however the best practice is to have a full backup available.

### Back up a database using SMF

From SMF, navigate to Forum Maintenance. (Administration Center -> Maintenance -> Forum Maintenance) On the database section, save the data and the structure. Then, compress the file. Select "Download" and wait for the database to complete the download completely. It is recommended if you use this method to verify that the backup is complete by opening the file and checking the last line. If the file is not complete and has an error please try one of the other methods to backup your database.

### Back up a database using PHPMyAdmin

PHPMyAdmin gives the option to export a database, from the initial page, select the "Export" option and follow the instructions. Select your SMF database. These are different based on host.

### Back up a database using a control panel

If your hosting service provides a control panel interface, this can be used to back up a database. Selecting the "Backups" or "Backups Wizard" options should take you to a page, prompting you to back up your database. With different hosts, these options may have different titles.

## Upload files method 1: using FTP

If your server doesn't support webinstall.php than you can use an FTP client and an FTP access to upload the files to your server.

All you need to do is upload all of the files in this package, excluding this file itself, to your server. You should upload it to the same directory as your previous installation of SMF or YaBB SE. If you are given the option to "resume" uploads, make sure you do not do that - you must upload all of the files. You may wish to make sure that all of the files were uploaded, such as those in `Themes/default/languages`, because some FTP clients have been known to drop files.

### Language files

If you are using additional languages it will be useful to upload also the updated versions of the language files along with the upgrading packages. Doing so all updated text strings will appear correctly after the upgrade, and will allow the upgrade to run in your selected language.

## Set file permissions

After the upgrade archive has been uploaded and extracted, you need to set the files' permissions. This is commonly done by use of the Unix utility CHMOD. The correct CHMOD value for SMF files is either 777, 775 or 755, depending on your hosting service. There are two methods for this step, the method used depends on the hosting service that you use.

### Setting File Permissions With the Upgrader

The SMF upgrader can set file permissions simply and easily. Navigating to the directory where SMF is located should redirect you to the upgrade.php file and prompt the upgrader. For example: www.yourdomain.com/forum/upgrade.php. If the upgrader detects files that need their permissions adjusted it will prompt for FTP details so it can CHMOD the files it requires for the upgrade. This may not work on some servers.

### Setting File Permissions With FTP

Using a control panel or FTP client, file permissions can be changed quickly and easily. Usually, FTP programs will allow permissions to be changed by right-clicking files/directories and selecting "Properties", "Attributes" or "Permissions". The desired numerical value can be entered, or if provided, check boxes can be changed.

The following files and directories must be writable. Depending on how your server is set up, this could mean that they must have CHMOD values of 644, 664 or 666 for files, and 755, 775 or 777 for folders:

- /attachments
- /avatars
- /Packages
- /Packages/installed.list
- /Smileys
- /Themes
- agreement.txt
- Settings.php
- Settings_bak.php
- upgrade.php

If the permission on your files or folders does not make them writable, the SMF upgrader will report the problem. In that case, use your FTP client or host panel to reset the permissions for the files or folders the upgrader reports.

## Run the upgrading tool

The final step in upgrading SMF, is to run the upgrading tool. Navigate to the directory where SMF is located. It should redirect you to the upgrade.php file and prompt you to run the upgrade. In example: www.yourdomain.com/forum/upgrade.php.

The first page you see may request your FTP information. If you see this screen, it is because the installer found some files or folders with inadequate permissions for SMF to run properly. If you enter your FTP information here, the installer can automatically fix these permissions for you. Please note that the path should be the same path you see in your FTP client. For example, it might be "public_html/forum". And remember, the installer will not save your FTP password anywhere.

### Upgrade settings

Backup database with the prefix "backup_"
  Selecting this option will get the upgrade tool to copy all data in the database before upgrading within the original database.
Maintenance Mode
  Selecting this option will place the forum into maintenance mode while upgrading rather than showing errors, this is highly recommended.
Output extra debugging information.
  The upgrade tool can give detailed information while performing an upgrade by selecting this option, it will aid the support team to solve any errors if they occur while upgrading.

## Upload files method 2: using webinstall.php

Your server may support webinstall.php. This script will automatically download SMF to your server. This may not work on all servers and also may require providing it with FTP details.

The first thing you need to do is upload webinstall.php to the location of where SMF is to exist on your server.

After you have finished uploading the file, point your browser to http://www.yourdomain.tld/forum/webinstall.php - where www.yourdomain.tld/forum is the URL to where you uploaded it. You should then see the webinstall interface.

The first page you see may request your FTP information. If you see this screen, it is because the webinstaller found some files or folders with inadequate permissions for SMF to run properly. If you enter your FTP information here, the webinstaller can automatically fix these permissions for you. Please note that the path should be the same path you see in your FTP client. For example, it might be "public_html/forum". And remember, the webinstaller will not save your FTP password anywhere.

On the webinstall interface you have an option to login, this is useful for charter members to easily download early releases. You may have an option to select multiple versions of SMF to download. It is up to you to decide which version of SMF you wish to install. Additionally you may have options of additional languages to download.

After specifying these options and agreeing to the agreement, webinstall will attempt to download al SMF files and decompress them in the same folder as webinstall.php. If successful you will be prompted to the SMF upgrade screen. If this fails you will need to follow the process below to upload files.

In most cases, you'll want to have "Put the forum into maintenance mode during upgrade." checked, because it will ensure that nothing is messed with while the upgrader is working. You may also wish to check "Backup tables in your database...", which will make a backup of your old information and tables before making any changes in the database.

## Finishing the upgrade and cleaning up

Once all parts of the upgrade have completed, check the box to remove the upgrade files from the server. If this does not work, they will need to be deleted via FTP. All upgrade files should be removed from the server once the upgrade process is complete. These files are upgrade.php and the .sql files whose name starts with 'upgrade'. They are a major security risk if they are left on a server unattended. Once SMF has been upgraded, they are no longer needed.

Good luck!
Simple Machines