Planning a Moodle 5.1 upgrade from a 4.2.3 or later site
If you run a self-hosted Moodle, the first question is whether your site can reach 5.1 directly. Moodle 5.1 was released on 6 October 2025 and has general support until 5 October 2026 and security support until 19 April 2027. To upgrade, your site must already be on Moodle 4.2.3 or later, so any site on an earlier 4.x release needs an intermediate step first. Confirm your exact build under Site administration and in the version.php file of your install before you book any work, because a site that looks close to the line may still be below it.
The path choice matters because the next long-term support release changes the calculation. Moodle 5.3 is the next LTS, with general support until 4 October 2027 and security support until 1 October 2029, and it requires sites to run Moodle 4.4 or later. If you are on 4.2 or 4.3, you will need to move to 4.4 or later before 5.3 is reachable, so a direct jump to 5.1 may add a step you would otherwise avoid. Decide early whether you want to stop at 5.1 with a planned move to 5.3, or whether your target is 5.3 and 5.1 is only a waypoint. Read the Moodle 5.1 release notes alongside the release schedule before you commit to either path.
The /public change is the item most likely to cause an outage. From 5.1, the web server document root must point to the new public directory instead of the main Moodle folder, and plugins installed earlier must be moved into the new layout by hand. If the root still points at the old folder, users may see directory listings or errors on the day you switch. Plan a change window for the web server configuration, plugin relocation and a rollback path, and test the new document root on a staging copy that mirrors your production web server, PHP-FPM pool and reverse proxy rules.
What Moodle 5.1 changes and what each change means for you
This table lists the Moodle 5.1 changes that affect a self-hosted site, from the web server document root to database and PHP minimums. Each row states the impact and the action to take before go-live. The main takeaway is that the /public document root change and manual plugin moves are the two items most likely to break a site if they are missed.
| Change | Impact on your site | Action needed |
|---|---|---|
| Document root moves to /public | Web server pointed at the main Moodle folder may show directory listings or errors | Repoint the document root to the /public directory and test every virtual host, including staging |
| Earlier-installed plugins | Plugins installed before 5.1 sit outside the new /public layout and may not load | Move each earlier-installed plugin into the new location manually and confirm each one loads |
| PHP 8.2 minimum | Servers on older PHP cannot run 5.1; 8.3 and 8.4 are supported | Confirm 64-bit PHP 8.2 or later on every web and cron node, and check custom code against it |
| PHP extensions and input limits | The sodium extension must be present and max_input_vars must be at least 5000 | Check the PHP configuration on each server, including any settings that override the defaults |
| PostgreSQL 15 minimum | Older PostgreSQL versions are not supported for 5.1 | Confirm your database version and plan a database upgrade before the site upgrade if needed |
| Other supported databases | MySQL 8.4, MariaDB 10.11 and Microsoft SQL Server 2017 or later are listed as minimums | Confirm your database engine and version against the 5.1 release notes before scheduling |
| Starting version | Sites must already be on Moodle 4.2.3 or later to upgrade to 5.1 | Confirm your current version and plan intermediate upgrades if you are older |
| Full list of changes | This table covers the changes most likely to affect infrastructure, not every change in the release | Read the complete list in the Moodle 5.1 release notes and check each item against your site |
How the /public directory change breaks sites and how to fix it
On Apache, the virtual host for the Moodle site must set its DocumentRoot to the public directory inside the Moodle code folder. Apache serves whatever sits under the document root, so a site left on the old path can show a directory listing of the Moodle code or fail with errors once the new layout is in place. Check the virtual host file, and any <Directory> block or .htaccess file that names the old path, because a leftover block can keep the old layout in effect.
- DocumentRoot: Update the
DocumentRootvalue in the site's virtual host, run a configuration syntax check, and then reload Apache. - Directory blocks: Review every
<Directory>block that refers to the old path, since these can override the new root. - Earlier plugins: Move plugins installed under the old layout into the new location by hand. Plan this copy in the same change window as the web server edit.
- Access checks: Request a file in the top-level Moodle code folder and confirm that it returns a not-found response, not a listing.
Before you edit a production virtual host, check the exact steps for your version in the Moodle 5.1 release notes.
On Nginx, the root directive in the Moodle server block must point to the public directory, and the PHP handling block must resolve script paths against that same location. Nginx does not read .htaccess files, so every path rule has to be in the server configuration itself. A missed change often shows up as a directory index, a blank page, or PHP errors when the request resolves to a script that is no longer where the configuration expects it.
- Root directive: Set
rootin the server block to thepublicdirectory, then test the configuration withnginx -tbefore reloading. - PHP handling: Check the
fastcgi_param SCRIPT_FILENAMEvalue and thetry_filesrule in the PHP location block, since both can still point to the old path. - Index files: Confirm that the
indexdirective loads the Moodle entry point and that noautoindex onsetting exposes the code folder. - Earlier plugins: Copy plugins installed under the old layout into the new location manually, then compare the file tree against the release notes.
After the reload, request a few top-level code paths and confirm that they fail cleanly. Keep the previous configuration file available so a rollback takes one step.
A reverse proxy or load balancer in front of Moodle does not replace the document root change on the web nodes behind it. The proxy forwards requests to backends, and each backend that runs Apache or Nginx still serves files from its own configured root. A common failure is changing the front door and missing one node, which then answers some users with listings or errors. Health checks can also mask the problem if they test a page that the old layout still serves.
- Every backend node: Apply the document root change to each web node, and record which nodes were changed so none is missed.
- Health checks: Point checks at a page that exercises PHP and the database, not a static file that may hide a broken root.
- Caching layers: Clear any cache in front of the nodes after the change, since cached responses can keep serving old paths or errors.
- Session affinity: Confirm that session handling works during a rolling change, so users are not signed out when traffic moves between nodes.
Before you make the change, ask the platform team which layer terminates TLS and where static content is cached. Confirm these details in your own environment, because the proxy configuration is specific to each deployment.
A test environment should match production closely enough that the web server change is exercised in the same way. Build it from a copy of the production code, configuration and plugin set, with the same web server type and proxy layer. Run the Moodle 5.1 upgrade there first, then apply the document root change and check the results before any production window. This is the only point where a missed plugin move or a leftover path is visible without affecting users.
- Front page and login: Load the front page, sign in with a test account, and open a course to confirm that pages render without errors.
- Top-level paths: Request files and folders in the top-level code directory and confirm that none return a listing.
- Plugin administration: Open the plugin overview and confirm that earlier plugins are detected in their new location.
- Logs: Review web server and PHP error logs during the test, and run cron once to confirm that background tasks complete.
Record each check and its result, so the production change can be verified against the same list. Confirm the test environment reflects your real proxy and caching setup, since a simplified test can miss the faults described in the other tabs.
What to back up and inventory before you touch the server
The /public change touches the web server, the code tree and the plugin layout at the same time, so a failed step is hard to unwind without a known-good copy. Each item below gives you something to restore from and a list to check the upgrade against.
Full database backup
Take a full dump of the Moodle database and confirm it restores into a scratch instance before you change anything. Record the database engine and version alongside the dump, because the 5.1 minimums (PostgreSQL 15, MySQL 8.4, MariaDB 10.11 or SQL Server 2017) decide whether your current server can run the upgrade at all. Keep the dump outside the web root and note who holds the decryption key if the backup is encrypted.
Moodle 5.1 notesThe moodledata directory
Back up the moodledata directory separately from the database, since it holds uploaded files, course content and caches that the database only references. Measure its size and confirm the backup includes permissions and ownership so the web server user can still write to it after restore. Check that the path in config.php points to the same location after the document root changes.
Code and plugin inventory with versions
List every core patch, local change and additional plugin with its installed version and its folder path. In 5.1, plugins installed earlier must be moved into the new layout by hand, so this list is your move plan. Mark any plugin with no 5.1-compatible release so you can decide to replace, update or retire it before go-live.
Custom themes and local plugins
Identify every custom theme and every plugin under the local or theme folders, then record which ones override core templates or call internal APIs. These are the most likely to break after the move, so test them first on the cloned environment. Keep a copy of each in version control so you can diff the 5.1 version against the original.
PHP extension and max_input_vars checks
Confirm on the production PHP runtime that the sodium extension is loaded and that max_input_vars is at least 5000, then record the current values. Run the check with the same PHP binary and configuration that serves the web application, since the CLI and FPM settings often differ. Capture the PHP version so the upgrade plan starts from a verified baseline.
A cloned test environment
Build a copy of production from the verified database dump, the moodledata backup and the code inventory, using the same web server, PHP and database versions. Point its document root at /public and run the full upgrade there before you schedule the production window. Use the clone to time the steps and to test the logins, cron tasks and custom code the plugin inventory flagged.
The upgrade sequence for Moodle 5.1 with checks and rollback points
This sequence moves a Moodle site to 5.1 in a test copy first, with a check at every stage and a named rollback point before production cutover, so the team can return to the working site if the upgrade or the new web root fails.
Confirm the starting version and backups
Confirm the live site runs Moodle 4.2.3 or later, since that is the minimum starting version for upgrading to 5.1. Record the current Moodle version, the PHP version, the database engine and version, and the web server document root. Take a full database dump and a copy of the moodledata directory, then confirm the dump restores cleanly into a separate database. This is the first rollback point: a restorable backup of the live site. Done when the restore test completes and the team has written down the current document root path.
Build a test copy of the live site
Restore the production database and moodledata into a separate test environment that matches the production server layout as closely as possible. Keep the test copy on the current Moodle code and web root so it reflects the live site exactly. Check that the test site loads, that cron runs, and that a sample of courses, files and user logins behave as they do in production. Done when the test copy is a faithful, working replica of the live site and the team can reproduce the current state on demand.
Bring PHP and PostgreSQL to the 5.1 minimums
In the test copy, upgrade PHP to 8.2 or later, using a 64-bit build with the sodium extension, and set max_input_vars to at least 5000. Upgrade PostgreSQL to version 15 or later, which is the minimum PostgreSQL version for Moodle 5.1, and confirm the database server accepts connections from the test copy. Check the PHP settings with the Moodle environment check on the current site before moving on. Done when the environment reports the required PHP extensions and settings and the database version is confirmed, with no outstanding blockers on the server requirements page.
Move earlier-installed plugins into the correct location
Identify every plugin installed before the /public change and move it into the location the 5.1 layout expects, since plugins installed earlier must be moved manually. Compare the plugin list against the versions available for 5.1 and note any plugin that has no 5.1 release. Run the upgrade in the test copy after the move so that plugin code is detected at its new path. Done when every plugin appears in the site administration plugin overview without missing-code errors, and the team has a list of plugins that still need a replacement or retirement decision.
Repoint the document root to /public in the test copy
Change the web server document root in the test environment from the main Moodle folder to the new public directory, which is required from Moodle 5.1. Reload the web server and load the site root, the admin page and a course page. Without this change the site may show directory listings or errors, so confirm that neither appears. Keep the previous document root path written down so it can be restored. Done when the test site loads through the new root with no directory listings, no 404 errors on static assets and no PHP errors in the web server log.
Run the upgrade in the test copy
Run the Moodle 5.1 upgrade on the test copy through the web interface or the command line upgrade script, and let all database and plugin upgrade steps complete. Record any errors, warnings or plugins that block the process, and resolve them before continuing. Then check the cron task, the scheduled tasks list and the logs for failures. Done when the upgrade finishes with no errors, the site reports version 5.1, and a full set of smoke tests passes: login, course access, file download, quiz attempt, grade report and email sending.
Verify the upgraded test site and sign off the rollback plan
Test the upgraded site with named users and the course types the organization relies on, including logins through the existing identity provider, course backups and restores, and any integrations. Review the security report and the environment check on the 5.1 test site. Write the rollback procedure: restore the database dump taken in the first step, restore moodledata, and point the document root back to the previous Moodle folder. Done when the business owners have approved the test results, the rollback procedure has been rehearsed once on the test environment, and the cutover window is agreed in writing.
Cut over to production with a verified rollback point
Put the live site into maintenance mode, take a fresh database dump and moodledata copy as the final rollback point, then apply the same plugin moves, PHP and PostgreSQL changes, document root change and upgrade used in the test copy. Run the same smoke tests on production and check logs for errors. If a critical test fails and cannot be fixed within the agreed window, restore the final dump and the previous document root. Done when the production site reports version 5.1, the smoke tests pass, and the team has retained the rollback backups until the agreed review is complete.
How the web server, /public root and PHP fit together after the change
The request starts at the browser and reaches the web server or reverse proxy, which must serve the /public directory as its document root. The server hands PHP requests to PHP-FPM, which runs Moodle code and reads and writes the database and the moodledata directory. The check that matters is the document root: if it points at the main Moodle folder instead, the main folder becomes reachable and the site can show directory listings or errors.
Request path from browser to Moodle after the /public change, with the misconfigured root shown separately.
Testing the new routing engine and sign-in before go-live
Treat the routing change as a test target in its own right. Moodle 5.1 introduces a new routing engine alongside the move of the web root to /public, so the first staging check is whether every URL class the site serves still resolves correctly after the document root is repointed. Confirm the exact routing behaviour, and any configuration it depends on, against the Moodle 5.1 release notes before you write the test cases, rather than relying on this summary. Plan to run the checks against a copy of production that has been upgraded, not against a fresh install, because plugin paths and reverse proxy rules only fail on sites that carry real history.
Build the go-live script around the paths users and systems actually hit. Cover sign-in first: every enabled authentication method in use (for example, a SAML 2.0 identity provider through the auth_saml2 plugin, LDAP or manual accounts), including logout, session expiry and password reset. Then test custom plugin pages and any local or activity plugin endpoints that were moved into /public during the upgrade, since those are the first things to break when a path is missing. Next, exercise web services and mobile or LTI connections with a test token, and confirm the reverse proxy forwards headers, callbacks and redirects the way your identity provider expects. Record each result with the expected outcome so a failure is easy to assign.
Make the rollback decision before the test window opens. Ask your team or partner to confirm, in writing, which checks are blocking (sign-in, admin access, cron, and the custom pages your users depend on) and which are cosmetic, and who signs off each. Check that the staging environment mirrors production in web server configuration, PHP settings such as max_input_vars, and the PostgreSQL version, because a passing test on a different stack proves little. Keep the pre-upgrade backup and the previous web server configuration available until the first full business day after cutover has passed without routing or sign-in incidents.
What makes a Moodle 5.1 upgrade take longer
This table lists the factors that push a Moodle 5.1 upgrade toward more effort, and the direction each one pushes. Read each row against your own site, then use the last column to decide what to request in a written quote. The main takeaway is that plugin count and age, custom code, and stacked PHP and database upgrades usually matter more than raw data size.
| Driver | Effect on effort | What to ask for in a quote |
|---|---|---|
| Number and age of third-party plugins | More plugins, and older ones, mean more compatibility checks, replacements and retests | A plugin-by-plugin list with a keep, update, replace or retire decision for each |
| Custom themes | Themes built on earlier Boost or Classic structures need template and CSS review against the 5.1 release | Confirm which themes are in use and whether each one will be reviewed on the new /public layout |
| Custom code and local plugins | Overrides, local plugins and web service functions need reading and testing, not just version bumps | A code review scope that names each local plugin and override, and who signs off on each |
| Database size | Larger databases lengthen backup, restore rehearsal and the upgrade run itself | Backup and restore timings from a rehearsal on a copy of your production database |
| moodledata size | Large file stores extend copy checks and any file permission or path changes | A confirmed plan for moving or sharing the moodledata path and a rehearsal of that step |
| Number of web servers | Each web node needs the document root change to /public and matching configuration checks | A checklist per node and a single owner for configuration parity across nodes |
| PHP and database upgrades at the same time | Moodle 5.1 requires PHP 8.2 or later and PostgreSQL 15 minimum, so stacked upgrades add platform testing | Which PHP and database versions are current and which are scheduled, with a test plan for each |
| Availability of a staging copy | Without a staging copy that matches production, the upgrade and /public change are tested late or not at all | Confirmation that staging mirrors code, database, moodledata and web server layout before work starts |
Questions teams ask before upgrading Moodle to 5.1
What does a Moodle 5.1 upgrade cost?
No fixed price applies, because the fee follows from the scope written for your site. The main cost drivers are the number of installed plugins, custom themes and code, how many environments need testing (development, staging and production), the size of the database and course content, and whether your PHP, database and web server stack already meets the 5.1 minimums. Some of this work is one-time, such as the upgrade, plugin remediation and testing. Other costs recur, such as hosting, patching and support after go-live. Ask any partner for a quote that lists each item separately, including plugin checks, the document root change and a rollback plan. DeployOpen provides a quote from a written scope and does not publish a price list.
How long does a Moodle 5.1 upgrade take?
Duration depends on scope rather than on the version number alone. A site with few plugins, standard configuration and an existing staging copy usually moves faster than one with custom themes, third-party plugins that need replacing, or integrations with identity and HR systems. Before you plan dates, confirm your starting version: sites must be on Moodle 4.2.3 or later to upgrade to 5.1. Also plan time for the upgrade on a copy of production data, user acceptance testing and the release window. Ask for a timeline that names each phase and the owner of each phase.
Can our own team upgrade Moodle to 5.1 without a partner?
Yes, if your team has the skills and capacity to run the work, and many do. The upgrade needs someone who can administer Linux web servers, PHP, the database and Moodle's upgrade process, plus a developer who can check plugins and custom code. The risk usually lies in the parts that are easy to miss: plugins installed earlier that must be moved into the new /public directory, custom code that relies on paths, and integrations that depend on a specific PHP extension or setting. Decide early which of these your team owns, and keep a named person accountable for testing and sign-off.
What information must we provide before an upgrade engagement starts?
A partner needs enough detail to write a fixed scope. Prepare the following before the first planning session:
- Your current Moodle version and the server stack, including PHP version, database engine and version, web server and operating system
- A list of installed plugins, custom themes and any local code, with version numbers
- Integrations with identity providers, HR systems, storage and other external services
- Database size, file storage size and backup arrangements
- Access to development or staging environments, and a named business owner for testing and sign-off
With these inputs, the scope can state what is included and what is excluded.
What happens if the /public directory change is missed?
From Moodle 5.1, the web server document root must point to the new /public directory, not the main Moodle folder. If it does not, the site may show directory listings or errors. Plugins installed before the upgrade also have to be moved into the new structure manually, so a plugin left in its old location may not load. Check the document root setting in your web server configuration, confirm the site loads from a clean browser session, and verify that plugin pages and admin tools work after the cutover. Add this check to your go-live checklist and to your rollback test.
Should we upgrade to Moodle 5.1 now or wait for 5.3?
The answer depends on your support deadlines and on how long your team needs to prepare. Moodle 5.1 has general support until 5 October 2026 and security support until 19 April 2027. Moodle 5.2 has security support until 4 October 2027. Moodle 5.3, released on 5 October 2026, is the next LTS with security support until 1 October 2029, and it requires PHP 8.3 or later, PostgreSQL 17 and a starting point of Moodle 4.4 or later. Confirm your current version and your organization's support policy before choosing a path. If you are on a version that cannot upgrade directly to 5.3, a staged route may be required. Check the official release notes for each version before you commit.
How DeployOpen scopes and delivers a Moodle upgrade
DeployOpen plans, implements, tests, documents and supports self-hosted open-source platforms inside your own infrastructure, including the Moodle 5.1 upgrade and the move of the web server document root to /public. Each engagement starts from a written, fixed scope that names your current Moodle version, server stack and plugins before any change is made.
How we scope
- Inventory your current Moodle version, PHP, database, web server and document root configuration.
- Audit installed plugins and custom code, and record which must move into the new /public layout.
- Agree in writing the environments, deliverables, testing scope and timeline before work starts.
How we build
- Build a staging copy of your site in your infrastructure and upgrade it step by step against the 5.1 minimums.
- Repoint the web server document root to /public and move earlier-installed plugins into the new structure.
- Test logins, cron, course content, themes and custom plugins on staging before any production change.
How we hand over
- Provide a runbook covering the document root change, PHP and PostgreSQL settings and the rollback steps.
- Document the test results, plugin decisions and configuration changes, so your team can review them.
- Walk your administrators through the go-live checks and the post-upgrade monitoring tasks.
How we support
- Offer ongoing support, upgrades and continuous testing for your Moodle site as a retainer.
- Confirm with your team the support window and the response expectations before go-live.
- Plan the next upgrade against the Moodle release schedule so your site stays on a supported version.

