Wrong $CFG->dbtype. You need to change it in your config.php file from 'mysqli' to 'mariadb'.

Wrong $CFG->dbtype. You need to change it in your config.php file from 'mysqli' to 'mariadb'.

by Doulos Xavier -
Number of replies: 3
Hi, 

This looks trivial. But I am not able to get past this. It is showing me a error I need to fix. 

Wrong $CFG->dbtype. You need to change it in your config.php file from 'mysqli' to 'mariadb'. 

I have changed the config.php which is under this directory (/home/moodle/public_html) 

It is changed to 'mariadb' but still the same error.  Any idea, what is going on? How  do I fix this?

<?php  // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle_dev';
$CFG->dbuser    = 'moodle_user';
$CFG->dbpass    = 'XXXXX';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
  'dbcollation' => 'utf8mb4_general_ci',
);
$CFG->wwwroot   = 'http://192.168.2.128/moodle';
$CFG->dataroot  = '/home/moodle/moodledata';
$CFG->admin     = 'admin';
$CFG->directorypermissions = 0777;
require_once(__DIR__ . '/lib/setup.php');
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problem
Average of ratings: -
In reply to Doulos Xavier

Re: Wrong $CFG->dbtype. You need to change it in your config.php file from 'mysqli' to 'mariadb'.

by Leon Stringer -
Bildo de Core developers Bildo de Particularly helpful Moodlers

This is very puzzling. The only explanation I can think of is that this is actually the wrong config.php. Try changing the $CFG->dbname to 'badname' and make sure you get Database connection failed. If you do then this is obviously the correct config.php and we'll have to think again.

The only other thing I can think of is if you had a PHP cache (such as OPcache) that cached scripts for a very long time. By default OPcache caches for two seconds, Moodle recommends 60 seconds.

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

Re: Wrong $CFG->dbtype. You need to change it in your config.php file from 'mysqli' to 'mariadb'.

by Doulos Xavier -
Thanks for the response. I managed to fix it. Did search for config.php in the server. Changed the DB name across all the files. Did a reboot and it worked.


Installation was a bit challenging. I was stuck in two places. One was the php.ini setting and second one was the config.php..looks like there were multiple php.ini and config.php files.


Any rate. It worked eventually.



Regards

In reply to Doulos Xavier

Re: Wrong $CFG->dbtype. You need to change it in your config.php file from 'mysqli' to 'mariadb'.

by Gregor McNish -
Moodles config.php should be in the root of the moodle server. Moodle’s site admin/server page has an option to see php info— this will tell you which php.ini is being used. The php.ini has to load the php extensions for the database server you’re using.