Note: You are currently viewing documentation for Moodle 2.0. Up-to-date documentation for the latest stable version is available here: Upgrading to Moodle 2.0.

Upgrading to Moodle 2.0

From MoodleDocs

When upgrading to Moodle 2.0, you must have Moodle 1.9 or later. if you are using an earlier version of Moodle (eg 1.8.x) then you need to upgrade to Moodle 1.9.x first.

We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect. Moodle 2.0 is a substantial upgrade and may require more planning and testing than you have become accustomed to in prior upgrades. Please read this page carefully before proceeding.


System requirements

  • PHP must be 5.2.8 or later although the latest 5.3.x is better if you have a choice.
  • Databases should be one of the following:
    • MySQL 5.0.25 or later (InnoDB storage engine highly recommended)
    • PostgreSQL 8.3 or later
    • Oracle 10.2 or later
    • MS SQL 2005 or later
  • Any standards-supporting browser from the past few years, for example:

Moodle 2.0 Planning

Moodle 2.0 is substantially different to the versions that went before it. You should expect much more planning and testing to be involved in upgrading to 2.0. It is highly likely not to be as straightforward as upgrades through earlier versions. Please read this document carefully and follow the advice. Please ask in the forums if you are not sure of anything. Don't try to upgrade your huge 1.9 production site over a weekend with no prior testing.

If you want to "just try it", fine, but please do it on a test copy of your production site.

If your users and admins have become accustomed to Moodle 1.9 you should note that there are some changes in the user interface. Again, it is a very good idea to upgrade a copy of your site and establish how you will be affected by the changes and what training and support your users may require (if any).

Lastly, consider not upgrading at all. It might be a good time to start with a completely fresh install of Moodle 2.0 and migrate your courses over (note that restoring 1.9 course backups into Moodle 2 will not be available until Moodle 2.1 is released).

Before upgrading please...

NOTE: The upgrade process will irreversibly modify the contents of your database and your moodledata file storage area. If something goes wrong you cannot go back. It is vital that you take good backups of both moodledata and the database in case you have problems with the upgrade. If you are not sure how see Site backup or ask in the moodle.org forums (explaining what your operating system is).

  • It's a good idea to read the dev:Latest release notes and the dev:Moodle 2.0 release notes
  • Always check your site to make sure it meets all system requirements for 2.0 in Administration > Server > Environment
  • Do a full database backup!
  • Do a full moodledata backup
  • Check your backups carefully
  • You must be running version 1.9 and it's probably a good idea to upgrade to the latest 1.9 if you have not done so already.
  • Remember to purge PHP cache if using any PHP accelerator

Any kind of 1.9 code in your installation will most likely stop the upgrade from completing. Don't try it!

A word about optional plugins and themes

If you have added optional or customised plugins (whether your own custom developments or from the plugins and modules database) or are using a non-core theme you must note that these will not work in Moodle 2.0+. While some plugins have been modified to work in Moodle 2.0+ at the time of writing most have not. The themes system is completely different in 2.0+ and all custom themes will require a complete rewrite.

Do not try to include any (old 1.9) optional plugins and themes (or any 1.9 code) in your Moodle 2.0 - it won't work. You should check to see if a 2.0 version is available. If not, you can safely ignore the message that the code is missing for the plugin during the upgrade. You will lose the functionality but the database tables will be retained (dormant) in case a 2.0 version of the plugin is produced in the future.

Required changes in database privileges

Moodle 2.x now uses temporary database tables, especially for backup and restore purpose. Make sure that the database account defined in config.php is allowed to create these temporary tables in its database. For MySQL, this is controlled by CREATE TEMPORARY TABLES privilege and you may need to grant that explicitly. In other database systems, your account probably has this permission already.

Checking database schema - old sites

This section is particularly relevant if you experience database errors during the upgrade.

If your 1.9 Moodle site has been upgraded through many prior versions (typically if it first existed prior to version 1.7) it is quite likely that there will be some problems with the database schema (compared to a fresh 1.9 installation). This may cause the upgrade to fail. If your site started life prior to Moodle 1.9 it is a very good idea to check and correct the database schema before upgrading. See Verify Database Schema. You should also run the database integrity checks in the XMLDB editor, see the 'See also' for a link to extra scripts to check for other discrepancies.

Now upgrade

Once you have satisfied the requirements for Moodle 2.0, follow the instructions on the upgrading page.

On Linux servers, Moodle 2.0 supports running the upgrade from the command line, rather than through a web browser. This is likely to be more reliable, particularly for large sites.

If it doesn't work

If the upgrade fails for any reason, it is imperative that you completely restore the 1.9 site from your backups before trying again. This particularly applies to moodledata. A likely result of not doing this is your files being lost in 2.x

After upgrade

The config.php file from your 1.9 installation should work fine but if you take a look at config-dist.php that came with Moodle 2.0 there are more/different options available (e.g. database drivers and settings). It's a good idea to map your old config.php settings to a new one based on the 2.0 config-dist.php.

Don't forget to transfer any password salt values in your old config.php (otherwise nobody will be able to login).

Update your php commandline cron jobs to point to the admin/cli/cron.php.

In versions 1.x, you could execute admin/cron.php either from command line or via the web. Since Moodle 2.0, the admin/cli/cron.php script can only be run via the command line.

Known and Discovered Issues

  • If you get an error about 'handling of PHP float numbers', please see the 'Moodle claims PHP float handling is not compatible' FAQ.
  • You now need some additional PHP modules installed (e.g. intl and the zip extension). If you do not have these, installation them depends entirely on how your PHP was first installed and your operating system.

Converting courses from 1.9 to 2.0

At present the usual way to do this is via a 1.9 to 2.0 upgrade as described above. It is not possible to import 1.9 (or earlier) backup files into 2.0, though this feature is now available in 2.1.

Two convertors

  1. Conversion thingy http://www.conversionthingy.net/Default.aspx Notes: Blog Post from Moodlenews
  2. Moodle in schools convertor http://www.moodleinschools.org.nz/forum/topics/4730

See also

Using Moodle forum discussions: