# Update from Moodle V5.0.2 and Moodle V5.2 scripts break the Moodle installation

**URL:** <https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393>\
**Category:** Virtualmin\
**Tags:** bug-report\
**Created:** [June 9, 2026, 12:47am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393 "2026-06-09T00:47:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 12:47am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/1 "2026-06-09T00:47:30Z")

</div>

Hi all,

This very embarrassing. Still those update scripts do not work.  
Now even the restore (by renaming the backup folder to public\_html does not work anymore. I also noted that [https://getcomposer.org/](https://getcomposer.org/) was being used now. Maybe this created the issue?

How to fix or roll back?

Warm regards,  
Rob Oudendijk

 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/1/8/18d2dc76c4dea8a749c6c5f57a818ac7a148646b.png)

---

<div class="post-metadata">

**Author:** ![stefan1959](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@stefan1959](https://forum.virtualmin.com/u/stefan1959)\
**Post date:** [June 9, 2026, 2:07am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/2 "2026-06-09T02:07:03Z")

</div>

Have you read the doc on upgrading. You seem to be doing a big upgrade and there docs indicate its pretty major.  
[https://docs.moodle.org/502/en/Upgrade\_overview](https://docs.moodle.org/502/en/Upgrade_overview)

Also by the looks it has its own upgrade script inside the program and it might give better will give feed back if your server is ok to do the upgrade.

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 2:30am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/3 "2026-06-09T02:30:52Z")

</div>

Stefan,

Thank you for the reply . The Virtualmin script should have been made to do all the work/checking that is needed?

Regards  
Rob Oudendijk

---

<div class="post-metadata">

**Author:** ![stefan1959](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@stefan1959](https://forum.virtualmin.com/u/stefan1959)\
**Post date:** [June 9, 2026, 2:32am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/4 "2026-06-09T02:32:03Z")

</div>

> [@robouden1](#):
>
> How to fix or roll back?

Easiest thing to to on virtuamin is use backup and restore. Hopefully you have created a scheduled backup.

---

<div class="post-metadata">

**Author:** ![stefan1959](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@stefan1959](https://forum.virtualmin.com/u/stefan1959)\
**Post date:** [June 9, 2026, 2:34am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/5 "2026-06-09T02:34:49Z")

</div>

what PHP version are you running?  
BTW I did a clean install of it and its fine.

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 2:36am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/6 "2026-06-09T02:36:04Z")

</div>

Stefan,

root@transom:~# php -v  
PHP 8.4.6 (cli) (built: Apr 11 2025 02:19:14) (NTS)  
Copyright (c) The PHP Group  
Zend Engine v4.4.6, Copyright (c) Zend Technologies  
with Zend OPcache v8.4.6, Copyright (c), by Zend Technologies  
root@transom:~#

regards  
Rob Oudendijk

---

<div class="post-metadata">

**Author:** ![stefan1959](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@stefan1959](https://forum.virtualmin.com/u/stefan1959)\
**Post date:** [June 9, 2026, 2:38am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/7 "2026-06-09T02:38:30Z")

</div>

OK, thats fine, thats the terminal in the Virtual Server?

 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/6/0/60dfe794a2b4b3dd781adde7fbf9e2c7bc95aa87.png)

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 2:49am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/8 "2026-06-09T02:49:34Z")

</div>

yes, terminal in Virtualmin. Is the script available, so I can check/modify what it does?  
What else does the script modify then it updates?

Regards  
Rob Oudendijk

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 2:55am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/9 "2026-06-09T02:55:52Z")

</div>

![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/7/4/743d48268cd00c643f5219f9eabf39703afbc123.png)

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 2:55am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/10 "2026-06-09T02:55:21Z")

</div>

![image.png](https://cdn.forum.virtualmin.com/uploads/default/original/3X/7/4/743d48268cd00c643f5219f9eabf39703afbc123.png)

---

<div class="post-metadata">

**Author:** ![stefan1959](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@stefan1959](https://forum.virtualmin.com/u/stefan1959)\
**Post date:** [June 9, 2026, 3:06am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/11 "2026-06-09T03:06:59Z")

</div>

It should be here  
[https://download.moodle.org/download.php/direct/stable502/moodle-5.2.zip](https://download.moodle.org/download.php/direct/stable502/moodle-5.2.zip)

You may have to reach to Ilia for help on this one.

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 3:22am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/12 "2026-06-09T03:22:42Z")

</div>

Stefan,

That is not the script I was thinking of. I like to see the script that Virtualmin uses to install Moodle. That is what I paid for.

Regards  
Rob Oudenidjk

---

<div class="post-metadata">

**Author:** ![jimdunn](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/jimdunn/32/3487_2.png) [@jimdunn](https://forum.virtualmin.com/u/jimdunn)\
**Post date:** [June 9, 2026, 3:58am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/13 "2026-06-09T03:58:22Z")

</div>

On my server (with Pro) I see these files:

```auto
/usr/share/webmin/virtual-server/pro/scripts/moodle.pl
/etc/webmin/virtual-server/latest-scripts/moodle.pl

```

---

<div class="post-metadata">

**Author:** ![jimdunn](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/jimdunn/32/3487_2.png) [@jimdunn](https://forum.virtualmin.com/u/jimdunn)\
**Post date:** [June 9, 2026, 4:04am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/14 "2026-06-09T04:04:04Z")

</div>

I see that here:

```auto
https://discuss.moodlebox.net/d/515-moodlebox-and-moodle-52

```

It says:

```auto
If you want to see my steps please look at https://moodlebox.net/en/help/moodle-version-update/
This description worked for me all the time until the Moodle folder was restructured in Moodle 5.1. It was a great work that Nicolas found the correct way to install Moodle 5.1. And now again ... Moodle 5.1 can't be upgraded to Moodle 5.2 with the instructions in the upgrade guide ... and the instructions are totally correct!

The Moodle 5.2 scripts changed again and we need to wait for good ideas. I get the message:
Error: Named route does not exist for name: core\route\controller\esm_controller::serve

```

NOTE that these are MoodleBox instructions so you probably can’t use them, but it shows that there’s some issue with upgrading world-wide…

---

<div class="post-metadata">

**Author:** ![stefan1959](https://cdn.forum.virtualmin.com/letter_avatar_proxy/v4/letter/s/49beb7/32.png) [@stefan1959](https://forum.virtualmin.com/u/stefan1959)\
**Post date:** [June 9, 2026, 4:06am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/15 "2026-06-09T04:06:48Z")

</div>

Thats the file the install script downloads, not sure how its handled after that, @Ilia will.

You should really have a schedules backup in case of issues like this.

Steve

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 9, 2026, 9:14am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/16 "2026-06-09T09:14:18Z")

</div>

Stefan,

I (and Claude Opus) got the site backup with 5.2. Running fine now.I gave Claude Opus access to the site and explained the issue, and it figured it out. Here a note from Claude:

## Report for the script’s author (Virtualmin `moodle.pl`)

The script’s **5.2 extraction was correct** — it matched the official zip byte-for-byte, config.php was placed properly (real config in root, loader stub in `public/`), and the DB was untouched. The failure was entirely in the **web-server reconfiguration for Moodle 5.1+'s new `public/` directory layout** :

**Bug 1 — wrong mechanism for the new web root.** Instead of changing `DocumentRoot` to `…/public_html/public`, the script appended to each vhost:

```auto
Alias / /home/transom/domains/lms.transom.jp/public_html/public/

```

…while leaving `DocumentRoot` and the only `<Directory>` grant on the **parent** `public_html`. Consequences:

- The aliased `public/` target had **no `<Directory>` permission block** → Apache denied it, so even the correct 5.2 tree wouldn’t serve.

- `Alias /` is a fragile way to relocate a docroot and conflicts with `DirectoryIndex`/`DocumentRoot`.

- **Worst side effect:** when the admin rolls back to a pre-5.1 tree (no `public/` subdir), that `Alias /` now points at a non-existent directory → the _old_ site **404s too** , making the rollback look broken. This is what cost the most diagnosis time.

**Bug 2 — PHP version not validated/bumped.** The domain stayed on its **PHP 8.2** FPM pool, but Moodle 5.2 requires **PHP ≥ 8.3**. The script should check the domain’s FPM version (not just the server CLI) and switch it (e.g. `virtualmin modify-web --php-version 8.4`), or abort with a clear message.

**Bug 3 — `max_input_vars` not set.** 5.2 hard-requires `max_input_vars ≥ 5000`; the upgrade refuses otherwise. The FPM pool had it, but the script should ensure it in the pool **and** CLI ini before running the upgrade.

**Bug 4 — no post-extraction upgrade / plugin migration.** The script left the DB un-upgraded and didn’t carry third-party plugins into the new `public/<type>/` tree. I had to migrate 11 contrib plugins (incl. `theme_adaptable`, `mod_questionnaire`, `paygw_stripe`) and let the upgrade auto-remove plugins dropped from core in 5.2 (`qtype_random`, `tool_moodlenet`, `block_section_links`, `block_activity_modules`).

**Minor:** the domain crontab still calls web cron (`wget …/admin/cron.php`), which Moodle blocks by default (`cronerrorclionly`) — pre-existing, not script-caused, but worth switching to CLI cron.

Warm regards,  
Rob Oudendijk

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [June 9, 2026, 9:56pm UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/17 "2026-06-09T21:56:37Z")

</div>

Which versions of Virtualmin and Webmin are you running, and what version of the Moodle installer are you using?

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 10, 2026, 1:08am UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/18 "2026-06-10T01:08:31Z")

</div>

![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/9/6/96b4b956a1483fbc63e7bd7cd6d165392be6900f.png)  
 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/8/2/8212fb80a1500f928193a93136553762661ad1ae.png)  
 ![image](https://cdn.forum.virtualmin.com/uploads/default/optimized/3X/3/0/30a90915677194a87c3d5e53d9ab060c157c75de_2_690x71.png)

Regards  
Rob Oudendijk

---

<div class="post-metadata">

**Author:** ![Ilia](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/ilia/32/10185_2.png) [@Ilia](https://forum.virtualmin.com/u/Ilia)\
**Post date:** [June 10, 2026, 12:44pm UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/19 "2026-06-10T12:44:01Z")

</div>

I’ve checked this again. The upgrade from Moodle 5.0.2 to 5.2.1 worked for me, but Moodle now shows a new optional environment warning:

 ![image](https://cdn.forum.virtualmin.com/uploads/default/original/3X/a/0/a0dd8cac444417a7095c45f89cdfc9b1e6b10831.png)

As I just figured, this is related to Moodle’s newer router, front-controller setup.

Moodle 5.1 introduced the new `/public` webroot, and also added routing support.

The 5.1 release notes say routing is recommended but not required, with a compatibility layer included.

That’s probably why my upgraded installation still worked, which is likely wasn’t using any feature or plugin that depends on the new router.

We are sorry about this breakage. Virtualmin now needs to handle not only the Moodle 5.1+ `/public` webroot, but also the router fallback configuration.

We’ll update the Moodle installer to configure this properly instead of just letting Moodle show the warning.

* * *

Meanwhile, you can fix this manually by configuring Moodle’s router fallback.

For Apache, edit the `.htaccess` file in Moodle’s public web directory, the `public/` directory inside the Moodle install.

If Moodle is installed at the site root, add:

```auto
FallbackResource /r.php

```

If Moodle is installed under a subdirectory such as `/moodle`, add:

```auto
FallbackResource /moodle/r.php

```

For Nginx, add a matching location rule. For a site at the root:

```auto
location / {
    try_files $uri $uri/ /r.php?$query_string;
}

```

For a site under `/moodle`:

```auto
location /moodle/ {
    try_files $uri $uri/ /moodle/r.php?$query_string;
}

```

After the web server rule is in place, edit Moodle’s `config.php` and add this before the final setup include:

```auto
$CFG->routerconfigured = true;

```

Then reload Apache/Nginx if you changed the main web-server config, and re-check Moodle’s environment page.

---

<div class="post-metadata">

**Author:** ![robouden1](https://cdn.forum.virtualmin.com/user_avatar/forum.virtualmin.com/robouden1/32/9198_2.png) [@robouden1](https://forum.virtualmin.com/u/robouden1)\
**Post date:** [June 10, 2026, 1:09pm UTC](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393/20 "2026-06-10T13:09:21Z")

</div>

LLIa,

Thank you for the fix.  
Yes, Clause was also suggestion changing the .htaccess.

Regards  
Rob Oudendijk

[Next page](https://forum.virtualmin.com/t/update-from-moodle-v5-0-2-and-moodle-v5-2-scripts-break-the-moodle-installation/137393.md?page=2)
