REALLY strange PHP error message???

REALLY strange PHP error message???

napisao/la Doug Moody -
Number of replies: 14

I have been getting a message in my daily CRON. Here is the strange section:

"

Starting processing the event queue...

PHP Parse error:  syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/content/90/2379690/html/moodle/question/engine/lib.php on line 338

So, I checked out the lib.php file, and around line 338 it says"

    /**

     * Get the translated name of an behaviour, for display in the UI.

     * @param string $behaviour the internal name of the model.

     * @return string name from the current language pack.

     */

    public static function get_behaviour_required_behaviours($behaviour) {

        $class = 'qbehaviour_' . $behaviour;

        return $class::get_required_behaviours();

    }

 

    /**

     * @return array all the file area names that may contain response files.

     */

So, anyone have a guess what is going on?

Prosjek ocjena: -
In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Matteo Scaramuccia -
Slika Core developers Slika Peer reviewers Slika Plugin developers

Hi Doug,
Moodle & PHP versions? It seems you're running PHP 5.3 code (Dynamic access to static methods is now possible) under PHP 5.2.

To run under PHP 5.2, it should be modified like e.g. in the lines below:

    public static function get_behaviour_required_behaviours($behaviour) {
        $class = 'qbehaviour_' . $behaviour;
        eval('$ret = ' . $class . '::get_required_behaviours();');
        return $ret;
    }

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

Hi Matteo,

Well, I AM running 5.3 - it is required for Moodle versions 2.0 and above. And I am running version 2.1.1 of Moodle, so the code ought to be 5.3, right?

I am not a PHP guru, but you spotted right away that the code is different. In  your opinion then, what kind of an error is this?

Furthermore, what's up with the "unexpected T_PAAMAYIM_NEKUDOTAYIM" ?

There isn't any such string in the file, I have no strings like that in my Moodle, so where is this coming from? It almost sounds like another language other than English, but the only language pack I have installed is English.

Its just weird! Do you think I ought to modify my code somehow?

In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Matteo Scaramuccia -
Slika Core developers Slika Peer reviewers Slika Plugin developers

Hi Doug,
Moodle 2.0 requires 5.2.8+, Moodle 2.1 requires 5.3.2+.

That being said, the string about the error is coming directly from PHP, not from Moodle, and the reason is that dynamic access to static methods is not possible, at least in PHP 5.2.

You could hack the Moodle core code with my sampled hack BUT first I strongly suggest to investigate if you're running the Moodle instance under PHP 5.3 using e.g. Administration > Server > PHP info.

When PHP version has been verified, I suggest to file an issue into the Tracker, unless people like Tim Hunt will provide a better hint.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

Hi Matteo,

Thank you for helping me track things down. I did check, and my PHP version is 5.3.6. Surely 5.3.6 i sbackward compatible, right? Have you heard about any issues on this version?

Regarding your hack --- Are you saying that I SHOULD use the code you provided, if I have 5.3.6?

In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Henning Bostelmann -
Slika Core developers Slika Plugin developers

Just a guess. Could it be that you're running cron from the command line (not via the web server), and that your command line PHP version is different from the one used by the web server? There was a similar case in MDL-28381 .

In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Matteo Scaramuccia -
Slika Core developers Slika Peer reviewers Slika Plugin developers

Hi Doug,
you could try my hack, if it will break the code you could always revert to the original file ;)

BTW, I've found the issue into the tracker: MDL-28303, which gives a different patch but highlights that this is related with PHP 5.2, no more supported in Moodle 2.1+. That's the reason why I was asking for the real PHP version under which your Moodle instance is running... CRON could have a different scope: MDL-28381.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

Henning and Matteo,

 

Thank you SOO much for taking the time to send me on a hunt. I will thoroughly investigate and get back here and let you both know what I find.

Just knowing that someone will tak a few minutes to share their brain really helps!namiguje

In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

Henning and Matteo,

As promised, I did more research and called my hosting service (godaddy) They were very helpful, and traced down the problem so the the CLI CRON would run automatically and not return that message.

What they did was to change the path that godaddy was executing from to EXPLICITLY specify that it was PHP 53 instead of 5.2 I asked why that had to be specified, and they said its because their server runs both 5.2 and 5.3 scripts, so I had to pass on the exact path.

It was passed on as follows from the CRON JOB manager at godaddy: /web/cgi-bin/php5_3 "$HOME/html/moodle/admin/cli/cron.php"

 instead of the previous: /web/cgi-bin/php5 "$HOME/html/moodle/admin/cli/cron.php"

Once I ran the script this way, it executed with MANY statements sent to me in the CRON daemon report at my email address. I then went to Godaddy and watched several processes running in teh background, initiated by this CRON job.

After that, I re-ran my backup report, and now I am getting this:

Last execution log

Course Time taken Status Next backup
STEM 6 Sep, 12:05 - 6 Sep, 12:05 OK 7 Sep, 00:00
Exploring Technology Systems 6 Sep, 12:15 - 20 Aug, 15:14 Unfinished 21 Aug, 05:30
Exploring Technology Systems Advanced 6 Sep, 13:15 - 31 Dec, 20:00 Unfinished 31 Dec, 20:
 
The two that report as "Unfinished" are the two courses in my Moodle. The STEM is the Front Page backup.
 
Do you notice the strange dates on the unfinished courses? I have never yet gotten a correct backup in these courses, and I am at a standstill as to why it is happening. Do you know any way to wipe out the execution log and start over from scratch. These dates never change, so something bad has happened to the original backup and I think they need to be reset, but I don't know how. Can you give me some help here please?
 
Thank you for pointing me in the right direction. I think if I get this worked out, I will have the whole thing fixed! smiješak
In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

Here is another piece of the puzzle. Compare the log above to this most recent log:

Last execution log

Course Time taken Status Next backup
STEM 8 Sep, 19:00 - 8 Sep, 19:00 OK 9 Sep, 15:40
Exploring Technology Systems 6 Sep, 12:15 - 20 Aug, 15:14 Error 21 Aug, 05:30
Exploring Technology Systems Advanced 6 Sep, 13:15 - 31 Dec, 20:00 Error 31 Dec, 20:00

 

The problem now is Error instead of Unfinished. Additionally, I received a CRON log and interestingly, it SAYS the backup was done correctly. Notice this portion of my CRON log:

"Running required automated backups...Backing up STEM...complete - next execution: Friday, 9 September 2011, 03:40 PM Backing up Exploring Technology Systems...complete - next execution: Friday, 9 September 2011, 03:40 PM Backing up Exploring Technology Systems Advanced...complete - next execution: Friday, 9 September 2011, 03:40 PM Sending email to admin Automated backups complete."

So how is it that I am being told on the one hand that the backup is in error or unfinished, but the CRON tells me that it is correct?? Either I have agood backup or I don't. Is there any way to tell the truth?

In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

NOw things are getting even STRANGER (If that's possible:

I just ran a CRON manually from the browser (xxx.com/moodle/admin/cron.php) and got this report:

Last execution log

Course Time taken Status Next backup
STEM 8 Sep, 19:00 - 8 Sep, 19:00 OK 9 Sep, 15:40
Exploring Technology Systems 8 Sep, 20:07 - 8 Sep, 20:07 OK 9 Sep, 15:40
Exploring Technology Systems Advanced 8 Sep, 20:07 - 8 Sep, 20:07 OK 9 Sep, 15:40

 

They worked! Nevertheless, the CRON job that is running from my host, using the command line method, is back to the original error message on line 338. The ONLY thing that I changed was changing my automated backups from manual (according to MoodleDocs, this method is for command line running) back to automatic. Now that they are automatic, and running them from the browser, produces the expected result.

Wow! this is really strange!

In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Matteo Scaramuccia -
Slika Core developers Slika Peer reviewers Slika Plugin developers

Hi Doug,
you should ask your Hosting Provider, here GoDaddy, to have the same PHP scope in both CLI and WEB. WEB equals to YOUR (being a shared hosting) Moodle instance, i.e.:

  1. same PHP version (DONE)
  2. same PHP configuration (php.ini, to be investigated)

This will give you the required scope equality and the possibility to go further with the investigations at Moodle side, if the errors will still exist in CRON under CLI.

Matteo

In reply to Matteo Scaramuccia

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

I am getting the unfinished error popping up again. The only thing I changed this time was the time of the CRON execution.

Will report back here with some tests...

In reply to Doug Moody

Re: REALLY strange PHP error message???

napisao/la Doug Moody -

The backup error messages are back again, and I have run out of ideas.

To recap, when I run an automated backup, I get either an error message, or a message that reports "UNFINISHED".

I can't trace where this is coming from.

Does ANYONE have an explanation and/or a fix for this? Its driving me nuts. It was broken, then it worked, now it is broken again.!

Please???