PHP error after upgrade from 3.11.3 to 4.0.7

PHP error after upgrade from 3.11.3 to 4.0.7

by Tim Widdup -
Number of replies: 18

Hi, after weeks of fighting I managed to finally upgrade our Moodle test system to 4.0.7.  At first it seemed to work ok, but now I'm getting the following PHP errors, as stated in the PHP Log...

[14-Apr-2023 14:38:28 Europe/London] PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 17259978496 bytes) in D:\VLE2\Root\lib\setuplib.php on line 1366

[14-Apr-2023 14:38:30 Europe/London] PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 17259978496 bytes) in D:\VLE2\Root\lib\setuplib.php on line 1366

[14-Apr-2023 14:38:31 Europe/London] PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 17259978496 bytes) in D:\VLE2\Root\lib\setuplib.php on line 1366

Any ideas of what maybe causing this - is it a memory leak in the application?

Thanks.

Average of ratings: -
In reply to Tim Widdup

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Ken Task -
Picture of Particularly helpful Moodlers

Dates of those are the 14th ... today is 17th.  They all refer to the same line in lib/setuplib.php - used in upgrading.   Did you check that line to see what the code is supposed to be doing?

Upgrades do attempt to use more memory.  First number it showed is 2Gig .. tried to allocate 17 Gig.

So check php settings for memory related items.

'SoS', Ken


In reply to Ken Task

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Tim Widdup -
Thanks Ken. I do realise that it's the 17th, but the problem is still there, the error messages were an example. It refers to the following function in the setuplib.php file, the line 1366 is the one in bold.

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: PHP error after upgrade from 3.11.3 to 4.0.7

by Ken Task -
Picture of Particularly helpful Moodlers

comment at head of that file:
/**
 * Large memory limit for given platform - used in cron, upgrade, and other places that need a lot of memory.
 * Can be overridden with $CFG->extramemorylimit setting.
 */

and the comment right above your clip says:

/**     
 * Converts numbers like 10M into bytes.
 *
 * @param string $size The size to be converted
 * @return int
 */

So I guess I would ask:

how much memory does your server have?  What is php setting for max memory for a script to consume? ... anything in php related to memory.

Do you have php xdebug extension turned on/loaded?  (requires even more memory and I have had issues with that being on in the past).  Not really needed for Moodle's debug.

'SoS', Ken



In reply to Ken Task

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Tim Widdup -
Hi. the server has 10GB memory installed. I don't know where to find out the php setting for the maximum memory to consume. I don't think we've got the xdebug extension turned on, but don't know where to check this either.
In reply to Tim Widdup

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Ken Task -
Picture of Particularly helpful Moodlers

Admin Menu, Server, PHP info.

and for xdebug - php.ini

10Gig of memory may not be enough!  Can you bump it to at least 16Gig?

'SoS', Ken


In reply to Ken Task

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Tim Widdup -
Looks like I may have xdebug - I've got the following lines in the PHP.ini file:

zend_extension="C:\Software\php\ext\php_xdebug-3.0.3-7.4-vc15-x86_64.dll"

[xdebug]
xdebug.extended_info=on
xdebug.remote_enable=on
xdebug.remote_autostart=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_mode=req
xdebug.idekey="netbeans-xdebug"
xdebug.profiler_enable=0
xdebug.profiler_output_dir="C:\Software\logs\"
xdebug.idekey=netbeans-xdebug

How do I turn it off?

I'll need to ask our IT Dept if we can get the memory upgraded at all.

Thanks.
In reply to Tim Widdup

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Ken Task -
Picture of Particularly helpful Moodlers

php.ini files should contain comment lines. Whatever character is in front of those lines means PHP will ignore them.

So, whatever that character(s) is/are, add them to the beginning of all the xdebug lines.

Restart apache service.

Then login to the Moodle and go to Admin menu, Server, PHP info..   You should not see it listed there.

So far, I have resisted getting on my 'soap box'.  Before I do, however, a question for ya ... is your entity a 100% Microsoft shop - in other words, IT will NOT run anything else but Windows?

'SoS', Ken


In reply to Ken Task

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Tim Widdup -
Ok, I will try this thanks. I'm not sure if this installation will only work on Windows, I inherited the system after my predecessor was made redundant, but it has always been on a Microsoft platform, so I'm guessing yes. To be honest, I'd like to migrate the data to SQL Server as well, as I have no knowledge of the obscure MariaDB.

Also, Please, please, please tell me what 'SoS' stands for, it's driving me nuts!
In reply to Tim Widdup

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Ken Task -
Picture of Particularly helpful Moodlers

Well, we wouldn't want to give you any more grief! smile

SoS = 'Spiriit of Sharing'

Inheriting a moodle site always an adventure - sometimes not pleasant at all ... and issues seem to go on forever!

Begin mini-soap box ...

If one looks at Moodle requirements - recommendations ...

Many years ago there was a small but significant sentence that said 'we recommend Linux'.   Been removed now, but still (IMHO) significant.

Docs in moodle are more often than not written for Linux - Ubuntu in particular.

Apache is not native to Windows.

MySQL/MariaDB not native to Windows.

PHP is scripting - also not native to Windows - bigger issue is drivers.

Ownerships/permissions - how does the line in config.php for those translate to
Windows?

and on and on - end-soap-box!

'SoS', Ken


In reply to Ken Task

Re: 'we recommend Linux'. Been removed now, but still (IMHO) significant [OT]

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
[off-topic]

Well, whether Moodle runs better on Unix/Linux or Windows can be debated, mostly propelled by emotions. ;)

But the fact is that the majority of the helpers on moodle.org belong to the Unix/Linux faction. No wonder, Moodle and Linux are both Free and Open Source Software.
In reply to Visvanath Ratnaweera

Re: 'we recommend Linux'. Been removed now, but still (IMHO) significant [OT]

by Tim Widdup -
Yes, well this is my gripe with Moodle - the only support you've got is the form (which is very helpful indeed!), but still no official support as with most products. So, if you're in my position, whereby hardly anybody on the forum has the same setup as I do, there is potentially no support if no one on the forum has come across my particular set of issues before if they've not experienced Moodle on a Windows setup.
In reply to Tim Widdup

Re: 'we recommend Linux'. Been removed now, but still (IMHO) significant [OT]

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
There is of course official support. Contact the nearest Moodle Partner.
Average of ratings: Useful (1)
In reply to Tim Widdup

Re: 'we recommend Linux'. Been removed now, but still (IMHO) significant [OT]

by Ken Task -
Picture of Particularly helpful Moodlers

Heretic hat on ... you are aware that Microsoft now offers an LMS which centers around TEAMS.  For your entity/needs, it might be your best choice!

LMS365 - https://lms365.com/

Heretic hat off

Now OT - everything is debatable!  Don't believe in 'one size fits all'. smile  My preference not really based on emotion, but past experience and frustration + supporting public school districts whose total technology budget for a year was $2,500.00.

Support for Windows in these forums ...

There used to be a Windows forum.  I have suggested it be re-instated due to differences in platform, but am not that much of an influencer.

There used to be a Moodle Partner that specialized in hosting Moodle's on Windows.   Don't think they exist any more.

'SoS', Ken



Average of ratings: Useful (1)
In reply to Tim Widdup

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I see that you've tried to Upgrade from 3.11.5+ to 4.0.5+ on Windows a couple of months ago. What happened to that?

Quoting the Site policy: "Once your problem is solved, reply to the thread, adding [Solved] to the subject line of your post and providing links to the documentation, discussion or tracker issue that helped you."

Since there was no feedback and you are still trying to upgrade 3.11 to 4.0, I assume that try went nowhere. If so, please don't start a new thread. You are simply wasting the energy of the helpers.
sad

Talking of energy, you've got excellent advice in your previous try. It may not be "official" nor "professional" in the sense that it costs money. Excellent nevertheless. If that failed, the next level is commercial support as in the off-topic sub-thread earlier.
In reply to Visvanath Ratnaweera

Re: PHP error after upgrade from 3.11.3 to 4.0.7

by Tim Widdup -
The previous post was not solved and this post is for a retry. So, as this post refers to different versions, to have tagged this onto the last post would've been misleading and inaccurate. I'm sure that most people who would see the date of the original post would assume that it is no longer active.