Upgrade moodle from 3.1 to 3.6

Upgrade moodle from 3.1 to 3.6

by Diogo Assis Ferreira -
Number of replies: 5

Hello!

I want to update my Moodle from 3.1.2+ to 3.6, but first I needed to update my PHP from 5.6.25 to 7.0.33. My Moodle is running in a Oracle Linux with MySQL 5.7.21.

Unfortunately, after upgrading my PHP the Moodle started throwing this error:

Debug info: 
Error code: invalidmysqlnativetype
$a contents:
Stack trace:
  • line 843 of /lib/dml/mysqli_native_moodle_database.php: dml_exception thrown
  • line 712 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->mysqltype2moodletype()
  • line 610 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->get_column_info()
  • line 157 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->get_columns()
  • line 466 of /question/engine/upgrade/upgradelib.php: call to database_manager->field_exists()
  • line 729 of /lib/environmentlib.php: call to quiz_attempts_upgraded()
  • line 475 of /lib/environmentlib.php: call to environment_custom_checks()
  • line 106 of /lib/environmentlib.php: call to environment_check()
  • line 105 of /admin/environment.php: call to check_moodle_environment()
Does anyone know what can it be?

Thanks in advance!

Average of ratings: -
In reply to Diogo Assis Ferreira

Re: Upgrade moodle from 3.1 to 3.6

by Ken Task -
Picture of Particularly helpful Moodlers

Typically, config.php file for moodle with MySQL has the following at the top:

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';

When you upgraded your PHP, did you get all the required PHP extensions ... like the drivers for MySQL ... which, am assuming on Oracle Linux, is either mysqli or mysqlnd

Check: from command line: php -m |grep mysql

should show all mysql related php modules.

'SoS', Ken

In reply to Ken Task

Re: Re: Upgrade moodle from 3.1 to 3.6

by Diogo Assis Ferreira -
Thank you for your reply Ken!

The command you suggested retorned
php -m | grep mysql
It seems like the required extensions are installed.

And my config.php file is using the mysqli extension

$CFG->dbtype    = 'mysqli';   
$CFG->dblibrary = 'native'; 


In reply to Diogo Assis Ferreira

Re: Re: Re: Upgrade moodle from 3.1 to 3.6

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, that much checks out ok ...

And you can use the mysql client on the server:

mysql -u [moodleuserinconfig] -p[moodleuserpassword] [ENTER] begets a mysql> prompt?

In config.php there should be a line for dbcollation.   What does it say?

Compare that to:

php mysql_collation.php -l

that's a lower case "L" for list

at the bottom of output, it will show/say:

Table collations summary for yoursite

then a summary of all the tables showing their collation.

also what is output of:

 php mysql_compressed_rows.php  -i

See: https://docs.moodle.org/37/en/MySQL_full_unicode_support

for more info.

'SoS', Ken

In reply to Ken Task

Re: Re: Re: Re: Upgrade moodle from 3.1 to 3.6

by Diogo Assis Ferreira -
The mySQL is in another server, but I don't think that connection is the problem. My moodle works just fine in some pages, I can even autheticate and enter on a few courses, but the error happens on a lot of pages, like on "Server > Environment"

The tables collation is "utf8_unicode_ci: 1469"
And my config.php file didn't have the dbcollation cofiguration, so I put it like
$CFG->dboptions = array(
'dbpersist' => false,
'dbsocket' => false,
'dbport' => '',
'dbcollation' => 'utf8_unicode_ci',
);

But it didn't make the trick.

And the output of 'php mysql_compressed_rows.php -i' was:
Notice: Undefined index: engine in my_moodle_path/lib/dml/mysqli_native_moodle_database.php on line 173
Database version: 8.0.15-commercial
Database name: name_of_my_database
Database engine: InnoDB
innodb_file_per_table: ON
innodb_file_format:


Thank you for your help!
In reply to Diogo Assis Ferreira

Re: Re: Re: Re: Re: Upgrade moodle from 3.1 to 3.6

by Ken Task -
Picture of Particularly helpful Moodlers

In the posting with debug, 'Oracle Linux with MySQL 5.7.21'.
In this last posting you say 'Database version: 8.0.15-commercial'
Please see:
https://docs.moodle.org/37/en/MySQL_full_unicode_support

In the error to one of those php scripts ... note is mentions 'engine' ...

Notice: Undefined index: engine in my_moodle_path/lib/dml/mysqli_native_moodle_database.php on line 173

version: 8.0.15-commercial

Could be MySQL ... version 8 of MySQL is barely out of shrink wrap so to speak (GA release is fairly new).
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-15.html

Using client from web server, connect to DB server.
Issue:

show engines;

on 5.7/.8 default engine now InnoDB if my.cnf set as per docs for Moodle and full unicode support.

You may have gotten on the 'bleeding edge'. :|

'SoS', Ken