3.4.4 upgrade to 3.5.1 Error 500

3.4.4 upgrade to 3.5.1 Error 500

by Alan Cherwinski -
Number of replies: 8

I am upgrading a 3.4.4 (latest downloaded today) version to 3.5.1 latest version.

Without the debugger on I get an Error 500 before any of the update starts.

With the debuggers enabled I get the following error on screen:

Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/extapps/public_html/placestolearn/moodle1/lib/classes/component.php on line 1265

I tried changing the ; to a : and that generated this error:

Fatal error: Non-abstract method core_component::get_component_list() must contain body in /home/extapps/public_html/placestolearn/moodle1/lib/classes/component.php on line 1265


My Php version is 7.01


the lines of code starting at 1265 look like this:

public static function get_component_list() : array {
        $components = [];
        // Get all plugins.
        foreach (self::get_plugin_types() as $plugintype => $typedir) {
            $components[$plugintype] = [];
            foreach (self::get_plugin_list($plugintype) as $pluginname => $plugindir) {
                $components[$plugintype][$plugintype . '_' . $pluginname] = $plugindir;


Any suggestions will be very much appreciated.  Thank you.  Alan

Average of ratings: -
In reply to Alan Cherwinski

Re: 3.4.4 upgrade to 3.5.1 Error 500

by Alain Raap -
Picture of Particularly helpful Moodlers

Are you using a caching server like Memcache? You could also try to purge the caches in Moodle (inside admin/cli directory or via the Admin console), sometimes this can help to solve errors. 

In reply to Alain Raap

Re: 3.4.4 upgrade to 3.5.1 Error 500

by Jae An -

I am having the same problem after upgrading from test system from 3.3 to 3.51.

I tried to run purge_caches.php from command line, but I am still encountering the same error message:


PHP Parse error:  syntax error, unexpected ':', expecting ';' or '{' in /var/www/moodle/lib/classes/component.php on line 1265

PHP Stack trace:

PHP   1. {main}() /var/www/moodle/adminqa/cli/purge_caches.php:0

PHP   2. require() /var/www/moodle/adminqa/cli/purge_caches.php:28

PHP   3. require_once() /var/www/moodle/config.php:27

In reply to Alan Cherwinski

Re: 3.4.4 upgrade to 3.5.1 Error 500

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

Are you *sure* you have the version of PHP you say you do?

I'm going to ask you to prove it wink

In reply to Howard Miller

Re: 3.4.4 upgrade to 3.5.1 Error 500

by Alain Raap -
Picture of Particularly helpful Moodlers

Another problem could be that the old php version is still active while php 7 installed. Check this with the (/usr/local/bin/)php -v command. I removed the complete php 5.6 version packages from my Linux system and then my latest version was 7.1.


Average of ratings: Useful (1)
In reply to Alain Raap

Re: 3.4.4 upgrade to 3.5.1 Error 500

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

php -v tells you the command line version of PHP, not the version that Apache is using. They are completely different. 

The only way to be sure is to create a little test script and run it through your browser. 

<?php phpinfo();
Average of ratings: Useful (1)
In reply to Howard Miller

Re: 3.4.4 upgrade to 3.5.1 Error 500

by Jae An -

You were correct about my Moodle server using an old version PHP.  

Once I have upgraded the PHP from 5 to 7, this problem went away.

Thanks!!!


In reply to Jae An

Re: 3.4.4 upgrade to 3.5.1 Error 500

by Alain Raap -
Picture of Particularly helpful Moodlers

Jae Ann you're welcome and hth! Howard you were right, phpinfo is a better way to check the php version on the server. Thanks for the tip!

In reply to Alan Cherwinski

Re: 3.4.4 upgrade to 3.5.1 Error 500

by John Wickenhaeuser -

I had a similar issue, but was able to upgrade just fine, however when I tried to run the 

/enrol/database/cli/sync.php -v command for the database enrollment script.


I had to completely remove php5.6 from the server because this one script was seeing it and failing.  It was not enabled in apache2, it did not report in php -v or when you create a file with 

 <?php phpinfo();?> in it.

Hope this helps someone else.