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: Difference between revisions

From MoodleDocs
No edit summary
 
(92 intermediate revisions by 14 users not shown)
Line 1: Line 1:
{{Moodle_2.0}}
{{Installing Moodle}}
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.


==Table of Contents==
'''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.'''
__TOC__


Moodle 2.0 requires differnent system requirements to other versions,they new requirements are listed below.


== Requirements ==
==System requirements==
Moodle is designed for the LAMP setup; Linux, Apaches, MySQL and PHP.
The requirements for Moodle are as follows. They may chage!!!


=== Hardware ===
* PHP must be '''5.2.8 or later''' although the latest 5.3.x is better if you have a choice.
* Disk Space: 160MB min
* Databases should be one of the following:
* Memory (RAM): 256 min, 1GB reccomnded, 50 users per 1GB RAM
** 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:
** Firefox 3 or later
** Safari 3 or later
** Google Chrome 4 or later
** Opera 9 or later
** MS Internet Explorer 7 or later (Even [http://googleenterprise.blogspot.com/2010/01/modern-browsers-for-modern-applications.html Google does not support IE6 any more])


=== Software ===
==Moodle 2.0 Planning==
* Web server software. Such as [[Apache]] or [[IIS]].
* [[PHP]] scripting language. The exact requirements for PHP in Moodle 2.0 are [[#php_requires|below.]]


<span id="php_requires">'''===PHP Configuration ==='''</span>
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.
=== PHP Configuration ===


* Version: 5.2.8 or later, it will not supportany earlier version.
If you want to "just try it", fine, but please do it on a test '''copy''' of your production site.
** PHP Settings. Check these settings in your php.ini or .htaccess file (if you're using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer.
*** ''register_globals'' '''MUST''' be OFF
*** ''safe_mode'' needs to be OFF.
*** ''memory_limit'' should be at least 128M. Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.
*** ''session.save_handler'' needs to be set to FILES.
*** ''magic_quotes_gpc'' should be OFF. Unlike earlier versions of Moodle.
*** ''magic_quotes_runtime'' needs to be OFF.
*** ''file_uploads'' needs to be ON.
*** ''session.auto_start'' needs to be OFF.
*** ''session.bug_compat_warn'' needs to be OFF.
** PHP Extensions and libraries
*** The mbstring extension is recommended.
*** The iconv extension is recommended.
*** [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make. (Freetype support is available as part of the GD extension for the 5.x versions of PHP)
*** The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.
*** The pgsql extension is required if you are using the PostgreSQL database.
*** The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.
*** The curl extension is recommended.
*** The tokenizer extension is recommended.
*** The curl and openssl extensions are required for the Moodle network functionality.
*** The xmlrpc extension is required for the Moodle network functionality.
*** The ctype extension is recommended for Moodle 1.8 or later.
*** Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).


=== Database ===
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).
* A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is ''the'' choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.
** MySQL 4.1.16 or
** Postgres 8.0 or
** MSSQL 9.0 or
** Oracle 9.0
** SQLite 3 (experimental)


=== Requirements notes ===
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).
More can be found at:
*[[Installing Moodle 2.0]]


== Verify the upgrade (optional) ==
==Before upgrading please... ==


If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].
'''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|upgrading]] page.
 
On Linux servers, Moodle 2.0 supports running the [[CLI|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 [[Installation_FAQ|'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===
#Conversion thingy http://www.conversionthingy.net/Default.aspx Notes: [http://www.moodlenews.com/2011/conversionthingy2-update-convert-moodle-backups-from-1-9-to-2-0/ Blog Post from Moodlenews]
#Moodle in schools convertor http://www.moodleinschools.org.nz/forum/topics/4730


==See also==
==See also==


*[[Installing Moodle]]
*[[dev:Moodle 2.0 release notes]]
*[[Installation FAQ]]
*[[Upgrading to Moodle 1.6]]
*[[Upgrading to Moodle 1.8]]
*[[Upgrading to Moodle 1.9]]
 
[[Category:Installation]]
[[Category:Upgrading]]


Using Moodle forum discussions:
*[http://moodle.org/mod/forum/discuss.php?d=166289 Discussion about fixing 1.9 database schema]
*[http://moodle.org/mod/forum/discuss.php?d=167997 DDL sql execution error when upgrading from 1.9.10+ to 2.0.1+]


==Last edit==
[[de:Auf Moodle 2.0 aktualisieren]]
--[[User:Rhodry Korb|Rhodry Korb]] 05:49, 13 February 2009 (CST)
[[fr:Mise à jour à Moodle 2.0]]

Latest revision as of 21:18, 2 October 2012

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: