Upgrading Moodle 3.8 to 4.3 (feat. PHP 7.4 to 8.1, and dealing with problem plugins)
HTML-код
- Опубликовано: 14 янв 2024
- Lots of stuff in this video. I upgrade a Moodle from 3.8 to 4.3 using git. Along the way a PHP version upgrade was also necessary, so I go through upgrading PHP from the Sury repository (No total OS upgrade necessary - though it is also a good option.
This time, I'm working with a booby trapped Moodle. i encounter numerous problems along the way and go through how to fix them. One problem very surprisingly sorts itself out...
0:40 - Initial Moodle setup
1:40 - Checking Environment variables
2:40 - Checking PHP and Moodle versions
3:25 - About PHP end-of-life versions
4:13 - Other things to consider (my additional plugins)
6:00 - Planning the next move
7:05 - Logging in and changing to the Moodle directory
7:15 - Making sure we're fully updated on the current branch (3.8.x)
8:25 - Putting the Moodle into maintenance mode
9:45 - Reminder to Take backups - don't try this at home (or anywhere else) without backups!
10:21 - Checking that all my plugins are also up-to-date
10:57 - Checking for updates on the Notifications page
11:29 - 1st upgrade 3.8.9 ▶ 3.11.18 (on PHP7.4)
13:27 - Checking for the updates on 3.11
13:45 - Checking for plugin updates for the new Moodle version (3.11)
15:10 - A note on updating sites with many plugins installed
15:33 - Planning the next upgrade step (to 4.0 - Checking the environment again)
16:31 - 2nd upgrade 3.11.18 ▶ 4.0.12 (still on PHP7.4)
18:37 - Checking for plugin updates for the new Moodle version (4.0)
19:28 - After updating plugins, the default settings screen (with a required setting)
20:44 - 3rd upgrade 4.0.12 ▶ 4.1.8 (still on PHP7.4) (I sing the praises of git yet again here)
21:42 - Checking the environment again for 4.1
21:53 - Checking the environment again for 4.2 (and one more reason why git is awesome)
22:40 - Realizing I can't move to Moodle 4.2 without first upgrading PHP
22:55 - Googling how to upgrade PHP (and what steps we need to do)
25:40 - Upgrading PHP - Step 1: Adding the Sury repository
26:55 - Upgrading PHP - Step 2: Update package info (apt update) to get info from the newly added Sury repo
27:38 - Upgrading PHP - Step 3: Installing a new PHP version (PHP8.1)
29:16 - Upgrading PHP - Step 4: Setting Nginx to use php8.1-fpm instead of php7.4-fpm
32:08 - Upgrading PHP - Step 5: Changing the CLI PHP default version
33:50 - Checking for plugin updates for the new Moodle version (4.1)
34:19 - Hitting the max_input_vars problem (fpm edition)
34:45 - Finding the php.ini files (apache2, cli,fpm, etc.)
35:40 - Fixing the max_input_vars problem (php-fpm). And some other tweaks.
39:30 - Stopping the now unused php7.4-fpm service (masking not uninstalling)
40:35 - Planning the next upgrade step (tp 4.3 - Checking the environment/plugins again)
41:25 - Attempted 4th upgrade 4.1.8 ▶ 4.3.2 (on PHP8.1) (I sing the praises of git yet again here)
42:02 - OMG a plugin got borked... (featuring debugging messages that weren't actually part of the video plan)
42:30 - Using git to go back to 4.1 after a failed upgrade to 4.3 (Did I mention that git is awesome?)
46:10 - Uninstalling the problematic plugin (yeah this was also bumpier than I expected... #EditingIsTooMuchWork)
46:55 - Removing the plugin by hand (using force!)
48:35 - That plugin really wants to stay...
49:30 - Cool command: uninstall_plugins.php (I'm hoping to do a video on this script sometime soon)
52:15 - Finish arguing with topcoll and try upgrading to 4.3 again
52:25 - Hitting the max_input_vars problem (cli edition)
52:43 - Fixing the max_input_vars problem (php-cli)
55:11 - 4th upgrade 4.1.8 ▶ 4.3.2 (on PHP8.1) Success!
55:50 - Just a quick note about the Cron message on the Notifications page
56:30 - Checking on plugins and having an unexpected success
57:51 - Purging caches after a lot of upgrades... Preventing the "clash of the caches"
Some commands used
Install a new PHP version for Moodle
sudo apt install php8.1-{pgsql,mysql,curl,xml,xmlrpc,intl,soap,gd,mbstring,yaml,zip,fpm}
Switch CLI version to use newly installed PHP
sudo update-alternatives --set php /usr/bin/php8.1
Links to resources viewed at the beginning of the video
moodle.org/plugins/format_top...
moodledev.io/general/developm...
howtoforge.com/how-to-install...
www.php.net/supported-version...
Hi Wisecat! Thanks so much for this video. I learned a lot, particularly the steps on upgrading PHP properly! Much appreciated.
Thank you. I'm glad to hear it helped.
You're amazing person!! Thanks a lot for your help. 🤗
Thanks so much for this lovely and encouraging comment. It really means a lot!
Thanks for this video!! Greetings from argentina
Glad it was helpful! And greetings to you from Japan!
Hi Wisecat, i have a comlicatied one i could use your guidence with.
i have an old Winodws 7 IIS machine currently running php 5.4 and Moodle 3.1
i need to get to the end target of latest php and moodle on a linux server.
but its so old Curl doesnt work on the windows machine. so i cant view the upgrade paths either.
Any suggestions
Complicated indeed. Well, I can think of two options.
First, you could take backups of all your courses, then build a new Moodle with all your plugins installed, and restore the courses there. Though you may run into difficulty with the question banks/random questions. Also, your users would need to re-authenticate with the new server.
The second way would be to copy the whole site to a Linux server, then gradually upgrade version by version, incrementing PHP and SQL versions as needed. This might actually be better if you don't have any additional plugins installed.
Either way, that's a fairly big job. Plan a few hours to do it. Good luck!
Hi WiseCat, thank you for the video. I have a little question. Where can i find the folder "vagrant.wisecat", (min 31:20) i know it is your domain but, with someone who install it in localhost or public ip from Azure. I'm looking that folder to change the PHP version that are moodle using. Thank you for your help!
There's no single correct answer to your question. This video may help though ruclips.net/video/mrGGGqBLj2M/видео.html
It all depends on how your server is setup and how the webserver gets the php processed. Either way, checking in PHP info is a very good starting point. Good luck!
Hi Sir, I Have question, When deciding to upgrade from Moodle version 3.xx, what is the best choice for the version we choose? do we upgrade to the latest version or the LTS version? thx u
In my opinion, it's best to keep the Moodle version updating every 6 months keeping it as up to date as possible while avoiding mid-semester upgrading. The server software is a different matter though and LTS versions of Debian12 or Ubuntu 22.04 for example, make nice, stable bases upon which to build.
I'll actually be presenting on this topic at the Japan Moodlemoot indico.cern.ch/event/1257438/contributions/5727514/
Hi WiseCat, thank for your video. Can you explain how to upgrade Moodle in a Docker environment?
I will try soon-ish. I've never done Moodle in a docker, but am eager to give it a whirl.
Super useful video! Many thanks.
To be honest, my limited knowledge of servers and Moodle precludes me from following the command line approach. I always use the manual FTP route of renaming the existing Moodle directory on the server and uploading the new version of Moodle and copying across the config.php file, etc. Then I download and upload the up-to-date plug-ins and theme.
My current version is Moodle 3.10.4 (Build: 20210510) and I want to update to version Moodle 4.3.3+ (Build: 20240308). I guess even manually I'll need a two-stage update?
Using FTP isn't a bad place to start, but the sooner you start using git the better. Git has a steep learning curve to start with but very quickly becomes much, MUCH easier for updates and upgrades!
@@Wise-Cat Many thanks! So, I installed Moodle manually (three years ago) using the FTP, etc route and my current version remains Moodle 3.10.4 (Build: 20210510).
Excuse my ignorance, but can I still upgrade to 4.3 using your two-step GIT 'Upgrading Moodle 3.8 to 4.3 (feat. PHP 7.4 to 8.1, and dealing with problem plugins)' video? That is, can I use GIT for updates on an original manual install?
Or would I have had to originally installed Moodle by pulling the code from the Git repository for the original 3.10.4 install?
Thanks for all your sterling work - I've been watching many of your videos. Hope my question makes sense!
Ah, I guess I need this video 'Easy Upgrading: GITify your Moodle' - I checked my main Moodle code directory and ran 'git status'. I do indeed see the 'fatal: Not a git repository (or any of the parent directories): .git' error.
3:54 / 37:46
Yes, indeed this video ( ruclips.net/video/pzqY758UpVI/видео.html ) talks about how to make your Moodle code into a git repository. There are other methods, but this one I find to be the most reliable and safe. The TL;DR being to use git to checkout Moodle code that matches the major version of Moodle you're running, copy across any plugins and the config.php file then switch the code used by the server over to the newly made one that uses git.
Do be sure to take a full backup (especially of the SQL database) before attempting this though.
Best of luck!
@@Wise-Cat Thanks for that. Watching your video as we speak. I'll watch it again (and maybe a further time!) as I am unsure about the deleting theme information. Our Moodle 3.10.4 runs the Adaptable theme (version 310.1.6) and it has been carefully set up for a certain look and feel. I'll need to get my head around the possible deleting theme part? I am running all the updates on a test installation of Moodle. I am looking to move forward and have always stayed clear of the command line but, thanks to you, I can now appreciate how easier it is for updates with git! I've always taken the 'novice' FTP route. Thanks again.