Every "mysterious" Moodle 5.2 upgrade failure I've debugged has come down to the same five things.
Not ten, not fifty. Five.
If your site broke after upgrading from 5.1, check these before you start touching the database.
1. The web root isn't pointing at public
This is one of the most common causes of Moodle 5.x upgrade problems. Since Moodle 5.1, the web-accessible code lives under public/. If your vhost is still pointing to the parent directory, you'll get 404s, failed security checks, and other weird errors.
DocumentRoot /var/www/moodle/public
root /var/www/moodle/public;
If you're on cPanel or shared hosting and can't edit the vhost, you'll need a configurable docroot, a symlink, or a location alias. If your host doesn't support any of those, that's a hosting limitation, not a Moodle problem.
2. The router isn't forwarding requests to r.php
Moodle 5.1+ sends non-file requests through r.php. If that's not configured properly, you'll see 404s, missing assets, and router errors in the environment check.
FallbackResource /r.php
try_files $uri $uri/ /r.php$is_args$args;
One thing that can be confusing here: if a .php-looking route returns a 404 instead of a 302, PHP-FPM may be handling the missing path before Apache gets a chance to fall back to r.php. That's a separate issue and needs to be debugged on its own.
3. Composer dependencies are missing
Moodle 5.1+ expects the vendor/ directory to be there. If it's missing, you'll get Composer errors during startup.
From the Moodle root, not public, run:
composer install --no-dev --classmap-authoritative
No shell access? Build the release somewhere else and upload the complete Moodle codebase, including vendor/.
4. A plugin is still using old class names
A classic example is:
Class "Mustache_Engine" not found
If you get this after an otherwise successful core upgrade, it's not necessarily a database problem. Moodle 5.2 uses namespaced Mustache classes, so an older plugin or theme that still calls the old class name can break the site.
Update or remove the offending plugin on staging and make sure you're using a release that actually supports Moodle 5.2.
Also, don't take a clean file copy as proof that a plugin is compatible. Check every non-core plugin against the Moodle version you're upgrading to.
5. Caches weren't properly cleared
After a clean upgrade, a lot of "this feature is broken" reports are just stale caches.
The file picker refusing to load is a good example.
Run:
php admin/cli/upgrade.php
Then go to Site administration > Development > Purge all caches.
On production, I'd use the CLI where possible. It avoids the browser, proxy, and timeout issues you can run into with the web upgrader on larger sites.
Check these five things first and a lot of Moodle 5.2 upgrade problems become much easier to track down.
Also, before you upgrade, back up all three:
- Code
moodledata- Database
Having a copy of the files alone isn't a rollback plan.
And always test the upgrade on a copy of the site before doing it in production.
I wrote the full step-by-step guide here, including the server requirements, clean code replacement process, a symptom-to-cause table, and when it's time to stop and roll back:
Top comments (0)