Error 500 when upgrading moodle 4.3 from 4.0

Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Number of replies: 21
Hi Guys I need some assistance I am upgrading from moodle 4.0 to 4.3 unfortunately after updating php to 8.1 I am getting this screen below

Error 500


My phpinfo file looks like this:

php
Average of ratings: -
In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Ken Task -
Picture of Particularly helpful Moodlers
Which did you upgrade first?   Your PHP or Moodle code?
Did you run the moodle server environment check first?

Refer to:

And how are you accessing/performing via browser using https://WHAT?   IP address or fully qualified domain name.

'SoS', Ken

In reply to Ken Task

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Hi Ken

Please see response below:

Which did you upgrade first? Your PHP or Moodle code? ----> Php
Did you run the moodle server environment check first? ---> Yes it only need an upgrade of my php version to 8.0 or above

Am using an IP address

Thanks
In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Ken Task -
Picture of Particularly helpful Moodlers
After upgrading PHP, did you restart apache service?
Did that restart re-launch without any errors?

Before you attempted the upgrade, were you accessing the site using private IP address or fully quailifed domain name?
Check wwwroot variable in config.php of code.   Does that have http://IPaddress or https://FQDN

Your php info page is cut off ...
Did the upgrade to php include new requirements of sodium extension and max_input_vars setting to at least 5000?

Using command line and from code directory, what do you get for responses to the following:

php -m |grep sodium
php -i |grep max_input_vars

Did you check your web service error log for clues?  See any MySQL has gone away?

'SoS', Ken

In reply to Ken Task

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Hi Ken

See my response below:

After upgrading PHP, did you restart apache service? - Yes with no errors reported
Did that restart re-launch without any errors?

Before you attempted the upgrade, were you accessing the site using private IP address or fully quailifed domain name? - Private IP
Check wwwroot variable in config.php of code. Does that have http://IPaddress or https://FQDN --> http://privateIP

Your php info page is cut off ...
https://moodledev.io/general/releases/4.3
Did the upgrade to php include new requirements of sodium extension and max_input_vars setting to at least 5000? - Yes I saw the new requirements

Using command line and from code directory, what do you get for responses to the following: --See my screenshot attached

php -m |grep sodium
php -i |grep max_input_vars

Did you check your web service error log for clues? See any MySQL has gone away?
Attachment Screenshot.png
In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Ken Task -
Picture of Particularly helpful Moodlers
max_input_vars should be set to a minimum of 5000 ... think Emma said she had her's set even higheer.

That's a PHP setting.   After making that at least 5000, restart apache service.   Check again with same command.  IF ok, then TIA ... 'try it again'!

Fingers crossed we get by the hickup! smile

'SoS', Ken

In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
After you upgraded PHP, did you recheck the environment page in Moodle to check that it was seeing the new PHP and that there were no additional requirements? -Did you reinstall all the necessary extensions for the new PHP version?
In reply to Emma Richardson

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Hi Emma

Thanks for reaching out, I couldn't' check the environment page as the 500 error page came immediately after the php update

Thanks
In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
I definitely had a similar issue - I ended up building a new server and didn't have any issues after that. But in my case, the php worked with 4.0 version and not 4.1 which was confusing. My guess would be that you did not install all the extensions for the new php version - can you share your full php version page?
In reply to Emma Richardson

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Hi Emma

See attachment below
In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
So, you are missing curl, gd and soap.   I am not sure soap is required but pretty sure curl and gd are...
Average of ratings: Useful (1)
In reply to Emma Richardson

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Ken Task -
Picture of Particularly helpful Moodlers
You are correct, Emma ... missing some ...

For the OP, here's everything you didn't wanna know about moodle 4.3 - but of which ... should probably be aware.


Odd that it doesn't mention php extensions required.

But, that info can be found:

And now that both Emma and I have 'fed you fish' .... please 'burp' when you are successful and drop a line back in these forums! smile

And just in case we forgot something, in code/admin/cli/ directory
there is a 'checks.php' script that will tell you what's missing!
(if you have installed php-cli - execute like: php checks.php [ENTER]!)

'SoS', Ken

In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Ken Task -
Picture of Particularly helpful Moodlers
"I couldn't' check the environment page as the 500 error page came immediately after the php update"

Huh?  Yet you've shared a phpinfo page from a phpinfo.php script at root of website????!!!

That makes no sense at all! :|

Do you have command line access to the server?

If so, please execute the commands I posted.

Comment: rebuilding server seems kinda drastic ... and think that would require the OP to have a site backup to restore.

@Victor: Got a site backup off the server that you could restore?

'SoS', Ken

In reply to Ken Task

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Hi Emma and Ken

I have decided to start all over again with setting up a new server environment(I have already finished setting up moodle 4.0), now just to let you know this is a new installation I have no data anywhere. The reason I need Moodle 4.3 is because there is a specific theme that I want to use that can only work with 4.3. I will appreciate your support on upgrading this 4.0 to 4.3. See attached screenshot the environment needs php 8+ I dont want to update it until you guide me on the next process.

Thanks
Attachment Screenshot 2023-11-24 204457.png
In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I didn't read the whole thing, but why don't you install Moodle 4.3 straight?
In reply to Visvanath Ratnaweera

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Thanks Visvanath, I did exactly that, I had read an article that mentioned you can only upgrade to 4.3 from earlier versions. Dint know it was possible.

Much appreciated
In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Let me guess... you saw it in the Internet, right?

big grin Never heard of the F... news?

No, seriously. The first thing you should have done is to post that link here and ask whether it is true.

Even better, forget that G... too and start your journey right here, at https://docs.moodle.org/ asking https://moodle.org/mod/forum/search.php?id=5.
sad

In reply to Victor Kosgei

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Ken Task -
Picture of Particularly helpful Moodlers
Am kinda in agreement with Mr. V.   Why not install 4.3 to begin with if this is a fresh install?

Guess we want practice in upgrading?

First order of business and.a VERY GOOD practice is to backup what you have prior to upgrading anything on server.


The check you see says you need to upgrade PHP prior to upgrading your version 4.0 of Moodle.

You are running Linux ... am going to assume it's Ubuntu.
What is the version of Ubuntu?
uname -an from command line

To upgrade your PHP you need to add to your package manager a repository for higher versions of PHP.

Now I don't use Ubuntu ... but I can Google! smile

Commands from the following site:
How to upgrade php to 8.1 ....
Commands ... in order:

add-apt-repository ppa:ondrej/php

apt-get update

apt install php8.1-cli php8.1-xml php8.1-gd php8.1-curl php8.1-mysql php8.1-ldap php8.1-zip 

* note: probably need to add php8.1-common to the above!

systemctl restart apache2

a2dismod php*

a2enmod php8.1

systemctl restart apache2

Check php version from command line:
php -v

Now upgrade your moodle:

Comment: Victor, we are all volunteers in these forums ... many still have jobs and or do commercial support of moodle.
What I've done above is along the lines of teaching you to fish .... you really need to be independent as you can be.

Yes, it can be frustrating ... so your success with moodle ... in upgrading and in using ...  many times is gonna test your failure quotient.  Suggestions: Do read docs!   Learn to use Google! smile

Best of luck!
'SoS', Ken
In reply to Ken Task

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Hi Ken

Much appreciated for the learning moment, finally was able to get it right. As mentioned I started a whole new clean installation this time I just went straight for 4.3. Now working fine. (An article made me believe it can only be upgraded ONLY from an earlier version)

Had actually spent couple of nights working on it, my frustrations led me back to the community for that much needed support

🙏
In reply to Ken Task

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
I live in a VM environment - firing up a new server isn't that hard and often much easier than chasing down stuff in an old server!
Average of ratings: Useful (1)
In reply to Emma Richardson

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Ken Task -
Picture of Particularly helpful Moodlers
Very true Emma!   As long as the provider's engineer decisions on what to provide customers align with what Moodle requires ... most providers do, BTW.

Next up for OP ... updating the 4.3.x installled (moodle doesn't stand still).

For future consideration ...

Why?
"The Moodle development team performs integration and testing of fixed bugs every Monday and Tuesday. On Wednesday you can install all patches by updating your code."

'SoS', Ken


In reply to Emma Richardson

Re: Error 500 when upgrading moodle 4.3 from 4.0

by Victor Kosgei -
Hi Emma

Same here VM to the rescue, quickly fired a new one up and set up moodle.

Much appreciated from Nairobi, Kenya!