Messaging Error that causes Server 500 error

Messaging Error that causes Server 500 error

by RTR Admin -
Number of replies: 8

I just finished upgrading my test site to Moodle 3.2.5+. Everything when really smoothly until I tried a couple of different administration links and was given an internal server error. I turned on debugging like I normally do and read this error. 


Notice: Undefined property: stdClass::$dirroot in /Corp/public_www/moodle/message/output/popup/message_output_popup.php on line 26

Warning: require_once(/message/output/lib.php): failed to open stream: No such file or directory in /Corp/public_www/moodle/message/output/popup/message_output_popup.php on line 26

Fatal error: require_once(): Failed opening required '/message/output/lib.php' (include_path='/Corp/public_www/moodle/lib/pear:.:/usr/share/php:/usr/share/pear') in /Corp/public_www/moodle/message/output/popup/message_output_popup.php on line 26


Oddly enough, I know exactly what the error is telling me, I just don't know enough about Moodle's source code to fix it. Can anyone help me with this problem?

Average of ratings: -
In reply to RTR Admin

Re: Messaging Error that causes Server 500 error

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The problem is that $CFG->dirroot is not defined in that message_output_popup.php file.

It might be too late at night... but does the require for config.php have one set of '../' too few?

In reply to Howard Miller

Re: Messaging Error that causes Server 500 error

by RTR Admin -

Thanks for the response. I downloaded the config.php file and didn't see it defined. I thought it might be an error so I downloaded the config-dist.php file to make my own config.php file and the class was not defined in that file either. I don't know the syntax for that line of code. Is it defined as the path to Moodle? Web or File? I thought it was strange it wasn't included or commented about in either file. I've never had this error before, it isn't stressful, but I would like to correct it. It only seems to effect Admin links for plugins.

In reply to RTR Admin

Re: Messaging Error that causes Server 500 error

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

dirroot is created automatically. There's no need to specify it. Tricky one this...

In reply to RTR Admin

Re: Messaging Error that causes Server 500 error

by Jon Bolton -
Picture of Testers

Just checking - the 3.2.5 is your first post is a typo? The latest version is 3.2.2+ and the dev version is 3.3.

I’m running 3.2.2+ and multiple 3.1 and earlier versions (some new, some upgraded) and I’ve not seen this error.

  1. What did you upgrade from?
  2. Might be obvious, but can you check that /message/output/lib.php exists on your server?
  3. Does the error affect all admin links or just some? If some, which ones?
  4. Can you check if apc.include_once_override = 1 in your php.ini (just clutching at straws and pulling on something else in the tracker)

---

Howard, as a dev wink, in the message/output directory, the require config only exists in message_output_popup.php, not the equivalent file for email, jabber or airnotifier. That will probably be related to legacy issues, but line 25 changed between 3.1 and 3.2...

3.1.5

require_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'); //included from messagelib (how to fix?)

3.2.2+

require_once(__DIR__ . '/../../../config.php'); //included from messagelib (how to fix?)
In reply to Jon Bolton

Re: Messaging Error that causes Server 500 error

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It would be nice to know how to reproduce this error. There's a strong possibility of a bug. I presume that this code isn't run with the default setup. 

I've always switched off messaging in Moodle so I don't know a huge amount about it (not a fan!). 

In reply to Howard Miller

Re: Messaging Error that causes Server 500 error

by RTR Admin -

Sorry for the typo...I upgraded from 3.1.2 to 3.1.5+. After I received the error, my immediate thought was it was going to defined in config.php, but it wasn't in the current or backup files. The code is actually running the default setup. It's on my test server that always runs unaltered Moodle versions to test them for compatibility. Nothing has been changed from the default installation. Funny thing...I opened the config.php file and resaved it and error went away for exactly one click. Even if you switch off messaging, it still appears.

In reply to RTR Admin

Re: Messaging Error that causes Server 500 error

by Victor Vitoriano -

I deactivated the message system, then deleted message_output_popup.php and it worked again, however, I no longer have the message system. But, it works.

In reply to RTR Admin

Re: Messaging Error that causes Server 500 error

by Michael B -

So I also just got the same message in my logs:


PHP Notice:  Undefined property: stdClass::$dirroot in /var/www/clients/client1/web1/web/moodle/message/output/popup/message_output_popup.php on line 26

PHP Warning:  require_once(/message/output/lib.php): failed to open stream: No such file or directory in /var/www/clients/client1/web1/web/moodle/message/output/popup/message_output_popup.php on line 26

PHP Fatal error:  require_once(): Failed opening required '/message/output/lib.php' (include_path='/var/www/clients/client1/web1/web/moodle/lib/pear:.:/usr/share/php:/usr/share/pear') in /var/www/clients/client1/web1/web/moodle/message/output/popup/message_output_popup.php on line 26


If I reload a page when I have the 500 server error i get it again. However if I remove the "?cache=1" in the url and load the same url as before it works. As soon as I load the url it will add "?cache=1" to the url again. If I reload then i will receive the same 500 server error. I'm ok with this at the moment but is there a fix?


I upgraded from 3.1.6 to 3.1.10 yesterday. Before that no problems.


Edit:


Never mind, I read the error message wrong... I added:


include_path='.:/usr/share/php:/usr/share/pear'

to my php.ini, restarted apache and it works without a problem.