Upgrade from 3.11.5+ to 4.0.5+ on Windows

Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Tim Widdup -
Number of replies: 15

3.11.5+ (Build: 20220211) to 4.0.5+?

I've only done one upgrade before to the version mentioned, so am quite new to this. 

We have:
MariaDB v10.4.12
php v7.4.27~
Windows Server 2016 standard

Are there any Moodle Windows experts out there!?

These are the instructions that were left to me by my predecessor:
1. Update all plugins on the previous version first (3.11.5)
2. Replace our current Moodle 'Root' folder with the 'Moodle' folder from the extracted .zip archive for the Windows version of Moodle 4.0.5+
3. Copy the config.php file from the previous version to the new version's folder (root)
4. Copy over any folders from the previous version's 'mod' folder to the new version's 'mod' folder, if they are missing from the new version.
5. Repeat step 3 for the 'blocks' folder
6. Navigate in a browser to the Moodle 'admin/index.php' page to start the upgrade

At step 6, I'm getting the following error:
Moodle upgrade page error

I've tried this upgrade several times now and I'm getting the same error each time, can anybody provide any assistance please?

Thanks.



Average of ratings: -
In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

What web server is this? IIS or Apache? Or something else?

Try putting an info.php page in the Moodle source code folder and see what's displayed when you access this in your browser. This is to check that PHP is working on the web server. If this also shows HTTP ERROR 500 then the problem is with the web server and not Moodle. If it shows the PHP version information then we know PHP is working on the web server.

In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I've just re-read your post, please can you elaborate on step 2?

There isn't a Windows version of Moodle, there's just a single source distribution for all systems. There's a Windows Installer for Moodle but this is really only suitable for non-production systems.

In reply to Leon Stringer

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Tim Widdup -
Hi Leon,

thanks for the suggestions. I didn't mean a Windows version of Moodle, I just use the Moodle Windows installer. The php.info file loads successfully and shows a lot of information, so it looks like it's a Moodle issue and not a PHP one. Is there any way of finding out what the problem might be do you know?
In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers
Enable debugging by adding these lines to config.php. Then try to access the page again so you get the HTTP ERROR 500 page and check Apache's error log (probably in the server\apache\logs subfolder) to see if there's anything helpful.
In reply to Leon Stringer

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Tim Widdup -
Ok, so some progress. The 'o365' folder was missing from the new installations Root\local folder. After I copied that over from the previous version, the Plugins check started, but now I'm getting the following error:

Plugins check
Installing missing dependencies
Debugging output enabled
Downloading auth_oidc ...
<- https://moodle.org/plugins/download.php/28062/auth_oidc_moodle41_2022112800.zip
-> D:\VLE2\Data/temp/core_plugin/code_manager/distfiles/e943b771703637ea374f18b2a64ed227.zip ... OK
Validating auth_oidc ... Error
[OK] Name of the plugin to be installed [oidc]


[OK] Plugin version [2022112800]
[Error] Required Moodle version [2022112800]
Installation aborted due to validation failure

Any ideas what can be done about this?

Thanks again.
In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Possibly the local_o365 version you copied into the local\o365 subfolder is the Moodle 4.1 version.

Check the $plugin->version line in local\o365\version.php. This must be 2022041910. You may have 2022112800 which is the Moodle 4.1 version of local_o365. Presumably this would cause the upgrade script to download the Moodle 4.1 version of auth_oidc resulting in this error.

In reply to Leon Stringer

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Tim Widdup -
Hi, I've managed to find the right version of the authentication plugin, however other plugins are requiring updates, which I though I'd done already - LightInTheBox is one of them which I can't seem to find anywhere & when I try to install it from the upgrade screen, I get the attached error - is this error something to do with the server it's running on?

Moodle upgrade Fatal Error.
In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

LightInTheBox is possibly Lightbox Gallery.

The fatal error is saying it's unable to allocate 64 GB of RAM which a) isn't surprising this failed, and b) the allowed memory size of 2 GB should be sufficient for the upgrade to complete. It's difficult to imagine what caused this, unless there's an infinite loop in Moodle (which would be a bug), or a bug in a plugin.

Hopefully downloading the plugin will fix the error. If the error is still occurring, please can you post the lines around 1365 of lib\setuplib.php, and maybe the five lines before and after so we can check the file looks correct. It should be something like this:

1360 function get_real_size($size = 0) {
1361     if (!$size) {
1362         return 0;
1363     }
1364
1365     static $binaryprefixes = array(
1366         'K' => 1024 ** 1,
1367         'k' => 1024 ** 1,
1368         'M' => 1024 ** 2,
1369         'm' => 1024 ** 2,
1370         'G' => 1024 ** 3,
1371         'g' => 1024 ** 3,
1372         'T' => 1024 ** 4,
1373         't' => 1024 ** 4,
1374         'P' => 1024 ** 5,
1375         'p' => 1024 ** 5,
1376     );
         ⋮
In reply to Leon Stringer

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Tim Widdup -
Hi, below are the lines from my setuplib.php file that corresponds to your example:

/**
* Converts numbers like 10M into bytes.
*
* @param string $size The size to be converted
* @return int
*/
function get_real_size($size = 0) {
if (!$size) {
return 0;
}

static $binaryprefixes = array(
'K' => 1024 ** 1,
'k' => 1024 ** 1,
'M' => 1024 ** 2,
'm' => 1024 ** 2,
'G' => 1024 ** 3,
'g' => 1024 ** 3,
'T' => 1024 ** 4,
't' => 1024 ** 4,
'P' => 1024 ** 5,
'p' => 1024 ** 5,
);

if (preg_match('/^([0-9]+)([KMGTP])/i', $size, $matches)) {
return $matches[1] * $binaryprefixes[$matches[2]];
}

return (int) $size;
}
In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Is there a $CFG->extramemorylimit line in config.php?

In reply to Leon Stringer

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Tim Widdup -
No, there doesn't appear to be.
In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I'm pretty much out of ideas at this point.

If you're upgrading via the web interface (not the command line) you could try stopping and starting XAMPP beforehand just in case there's some memory leak in Apache.

You could try running the upgrade via the command line (open a command prompt window, CD to the Moodle folder and run ..\php\php admin\cli\upgrade.php).

Beyond that the next thing I'd try would be writing the backtrace to Apache's error log for every call to get_real_size() in an attempt to determine what's suddenly causing it to try to allocate 64 GB of RAM.

In reply to Leon Stringer

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Tim Widdup -
Hi, thanks for all your help and suggestions with this. I can't find the php folder within the root folder for Moodle. There are multiple 'upgrade.php' files in various folders, do you know which is the correct one?
In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

It isn't in the moodle folder but in a sibling folder, thus the ..\ prefix. If you are using Moodle's install package for Windows the folders should be:

Screenshot of MoodleWindowsInstaller-latest-400.zip contents with php folder highlighted.

In reply to Tim Widdup

Re: Upgrade from 3.11.5+ to 4.0.5+ on Windows

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

I became aware of this discussion through the "follow-up" discussion. Is it true that a) You run your production Moodle runs the Windows Installer? b) You don't know where the PHP interpreter is?