Problem Description
I am upgrading Moodle from 5.0.1 to 5.1.3+ (current latest version). This upgrade includes the [Code directories restructure](https://docs.moodle.org/501/en/Upgrading#Code_directories_restructure) where the we must now (ideally) point DocumentRoot to the **public** subfolder of the moodle web package (this is so that some moodle php files can reside *outside* the web view).
I am running PHP 8.4.18 both under apache and in the terminal.
I am running the site on a WHM/cPanel combo and after researching, I should be able to simply replace the **public_html** directory in the cPanel home directory with a symlink to the **public** folder in the new moodle package (and similarly update the existing www symlink likewise).
The site works perfectly when using symbolic links pointing to the 5.0.1 version (package root folder) but when I swap over to the 5.1.3+ version (sym link to the package's public subfolder), it attempts to start the upgrade and then I get ERR_TOO_MANY_REDIRECTS as the site keeps redirecting between **./admin/index.php** and **./install.php**.
I have tried clearing caches in moodle:
```
rm -rf moodledata/cache/*
rm -rf moodledata/localcache/*
rm -rf moodledata/sessions/*
```
I have tried commenting out a redirect line in **./admin/index.php**.
I've created a test php file to output the value of `$CFG->dirroot` and it is correctly going to `/home/<myusername>/moodle/moodle_5.1.3`
Here is my home directory:

Here is the folder structure showing the moodle folder containing the previous and new moodle versions:

The redirects as I say are between **./index.php?lang-en** and **./admin/install/php**:

Any advice on what else I should try? Thanks
AI-Generated Solution
Powered by LMSouq AI · GPT-4.1-mini
Analyzing problem and generating solution…
Was this solution helpful?