Problem installing moodle-3.7.2

Problem installing moodle-3.7.2

by Carolina de los Santos -
Number of replies: 9

Hi! I'm installing moodle-3.7.2 and I'm having this problem:

Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home/content/31/9105531/html/lecasabe/moodle/lib/classes/component.php on line 1162

--

public static function get_all_versions() : array {

        global $CFG;

--

Can somebody help me? Thanks!!

Average of ratings: -
In reply to Carolina de los Santos

Re: Problem installing moodle-3.7.2

by Ken Task -
Picture of Particularly helpful Moodlers

Server meet specs/version requirements for 3.7.2 of Moodle?

What version of PHP is installed on your server?

https://download.moodle.org/releases/latest/

shows PHP 7.1, MariaDB 5.5.31 or MySQL 5.6 or Postgres 9.4 or MSSQL 2008 or Oracle 11.2

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Problem installing moodle-3.7.2

by kane wadel -

HI i have the same problem in this moment and about your question on PHP version my version is 7.2.1 as you can see in this image Information about PHP and MySql 

In reply to kane wadel

Re: Problem installing moodle-3.7.2

by kane wadel -
PHP 7.2.7 instead of 7.2.1 as I had written above
In reply to kane wadel

Re: Problem installing moodle-3.7.2

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Can you tell us the steps being used to install Moodle? Have you downloaded the source code and added a site to Apache (or similar)? Do you then access your site and the installation begins? Or are you using different installation steps?

Could you attach a screenshot so we can see how the message appears? If you could include the URL of the page when the error appears that may help us (assuming you're installing through the web interface). You can obscure or remove any information you don't want us to see (e.g. the domain name of the site).

In reply to kane wadel

Re: Problem installing moodle-3.7.2

by kane wadel -
1- first I followed the steps in the documentation (https://docs.moodle.org/37/en/Upgrading#Install_the_new_Moodle_software) so I backed up the folder Moodledata, all the files of my moodle installation, and my moodle database.
2- I Put your site into maintenance mode
3 - I Moved my old Moodle software program files to another location that I called "MoodleCampus35"
4-I Unzipped the upgrade file so that all the new Moodle software program files are in the location the old files used to be in on the server
5-as I had the adaptable theme I downloaded the latest version of adaptable I deleted the previous version and i replaced with the new (https://moodle.org/plugins/theme_adaptable)
6- Then I wanted to follow the next step in documentation which says

[Finishing the upgrade
The last step is to trigger the upgrade processes within Moodle.

If you put your site into Maintenance mode earlier; take it out now!

To do this just go to Administration > Site administration > Notifications.

Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can't do itself (very rare) then you will see messages telling you what you need to do.]
and there wanting to go off the maintenance mode I had an error
[Parse error: syntax error, unexpected ':', expecting ';' or '{' in /home2/coller9y/campus/lib/classes/component.php on line 1162]

Old Moodle files

the error
In reply to kane wadel

Re: Problem installing moodle-3.7.2

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

This is puzzling! As Ken originally mentioned, an old PHP version is the obvious cause. The error message "Parse error:  syntax error, unexpected ':', expecting ';' or '{' in …/lib/classes/component.php on line 1162" is exactly what PHP 5 will report for this file.

If you upgraded from Moodle 3.5 to Moodle 3.7 on the same server it's hard to imagine how the server would have PHP 5 as Moodle 3.5 requires PHP 7 and the upgrade won't proceed without the necessary version. Similarly, unless phpMyAdmin is on a different server, this shows PHP 7.2.7.

Firstly, can you confirm that phpMyAdmin is running on the same server as Moodle?

Secondly, can you create a text file called phpinfo.php with two lines:

<?php
phpinfo();

Then upload this file to the Moodle source code folder (presumably /home2/coller9y/campus) on the server.

Then access this file from a browser using the URL for the Moodle site with /phpinfo.php at the end (e.g. if your site is https://moodle.example.com then you'd access https://moodle.example.com/phpinfo.php).

Then tell us the PHP version at the top of this page. It should look something like this:

PHP info 5.4 orPHP info 7.1

You should remove this file after testing as it exposes technical information about the server to an attacker.

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: Problem installing moodle-3.7.2

by kane wadel -

1-Firstly, can you confirm that phpMyAdmin is running on the same server as Moodle?

  • Answer : Yes

2- Secondly, can you create a text file called phpinfo.php

Answer : 

Php Version

apparently, you have just seen on the version of the server. what is there to do then please? 


In reply to kane wadel

Re: Problem installing moodle-3.7.2

by kane wadel -
ahhhhh ok you were right sir ken and Leon.
so I upgraded the php version to server level and the installation to continued
Thank you for your availability all is good right now.
In reply to kane wadel

Re: Problem installing moodle-3.7.2

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Why are the old files in your new moodle code folder? You would not replace the adaptable folder as it would not be in the new folder - that is confusing. The error seems to indicate something is wrong with the file indicated - is it possible that you overwrote the old moodle code folder instead of moving the entire folder elsewhere and then adding the new code folder?