How to Upgrade Moodle 4.2.5 to Moodle 5.0.1
To upgrade Moodle 4.2.5 to Moodle 5.0.1, follow this structured process, which aligns with Moodle’s official documentation and best practices1234:
1. Check Server & Software Requirements
- Supported Upgrade Path: You can upgrade directly from 4.2.5 to 5.0.1 (Moodle 5.0 only supports upgrades from 4.2.3 or later)12.
- PHP: Minimum 8.2.0 (64-bit only). PHP 8.3.x/8.4.x also supported.
- Database: PostgreSQL 14+, MySQL 8.4+, MariaDB 10.11.0+, SQL Server 2017+. Oracle is not supported in Moodle 5.0+.
- PHP Extensions:
sodium
is required. - PHP Setting:
max_input_vars
must be ≥ 5000. - Database Prefix: Must not exceed 10 characters.
- In Moodle, go to Site administration > Server > Environment and check for any warnings or errors for Moodle 5.013.
2. Preparation & Backup
3. Check Plugins
- Visit Site administration > Plugins > Plugins overview.
- Update all plugins and themes to versions compatible with Moodle 5.01.
- If a plugin is not compatible, remove its code (do not uninstall via the UI, to preserve data), or update it1.
4. Enable Maintenance Mode
5. Replace Moodle Code
- Download Moodle 5.0.1 from the [official Moodle download page]4.
- Upload the new Moodle package to your server.
- Create a backup of your current Moodle code (e.g., move everything in your Moodle directory to a new folder like
OLDSITE
)4. - Extract the new Moodle code into your Moodle directory4.
- Copy
config.php
fromOLDSITE
to the new Moodle directory4. - Copy any custom plugins/themes (ensure they are compatible).
- Do not overwrite the
moodledata
directory.
6. Start the Upgrade Process
- Web Interface: Open your Moodle site in a browser. The upgrade will start automatically—follow on-screen instructions134.
- Command Line (recommended for large sites): bash
php admin/cli/upgrade.php
- The process will check plugins and update the database schema15.
7. Post-Upgrade Steps
- Complete the upgrade: Ensure all steps show “success” and resolve any plugin issues15.
- Disable maintenance mode.
- Test your site: Check user logins, course access, file uploads, and plugin functionality.
- Review logs for errors.
8. Cleanup
- Once satisfied, you may delete the backup of your old Moodle code (
OLDSITE
). Keep your database and data directory backups for a while4.
Upgrade Steps Summary Table
Step | Action |
---|---|
Check Requirements | PHP, DB, extensions, environment check |
Backup | Moodle code, moodledata , database |
Plugin Compatibility | Update or remove incompatible plugins |
Maintenance Mode | Enable via admin interface |
Replace Code | Upload/extract Moodle 5.0.1, restore config.php , custom plugins |
Start Upgrade | Visit site or run CLI upgrade script |
Post-Upgrade Checks | Test site, resolve issues, disable maintenance mode |
Cleanup | Remove old code backup after confirming stability |
Important Notes
- Never skip backups.
- Test the upgrade on a staging copy first.
- Check plugin compatibility before upgrading.
- Do not use Oracle Database—unsupported in Moodle 5.0+.
- Upgrade may take significant time for large sites—plan accordingly.
For full details, consult the [Moodle Upgrading documentation]13.
References:
1: Moodle Upgrading Guide
2: Moodle 5.0 Release Notes
3: Upgrade Overview
4: Tech Fry: How to Upgrade Moodle
- https://docs.moodle.org/en/Upgrading
- https://moodledev.io/general/releases/5.0
- https://docs.moodle.org/en/Upgrade_overview
- https://www.techfry.com/moodle/how-to-upgrade-moodle
- https://www.youtube.com/watch?v=eGzlGvCyXVA
- https://docs.moodle.org/en/Upgrading_FAQ
- https://www.idslogic.com/blog/moodle-5-0-release-features-enhancements-lms-upgrade
- https://mindfieldconsulting.com/how-to-upgrade-moodle-from-2-0-and-2-x-to-latest-version/
- https://www.youtube.com/watch?v=0ejRODDEHJg
- https://www.youtube.com/watch?v=aSoW-Jd3xqs