Page 1 of 2
utf8 warning at installation step 4
Posted: Wed Mar 09, 2022 5:33 pm
by lwescott
Hi,
Newbie here, first time install. I am trying to install FormaLMS 2.4.5 on a LAMP stack running Apache 2.4.52, MySQL 8.0.28, PHP 7.0.33 on Ubuntu 20.04.
I run the installation wizard and in step 4 it tells me my database is not UTF8.
I went as far as to create a new db in MySQL, using this:
CREATE DATABASE formalms2 CHARACTER SET utf8 COLLATE utf8_general_ci;
However, I still get this error: "The specified database is not utf8 charset." on step 4 of the config wizard.
I didn't find anything useful in the forums. If I didn't look properly, feel free to point me in the right direction. I've been banging my head against the wall on this for a couple of hours and I am getting nothing but a headache.
I'm missing something... any ideas?
Thanks,
Larry
Re: utf8 warning at installation step 4
Posted: Wed Mar 09, 2022 6:08 pm
by alfa24
Can you run this query on dB?
show variables like 'character_set_database'
Re: utf8 warning at installation step 4
Posted: Wed Mar 09, 2022 7:18 pm
by lwescott
Hi,
It tells me (of course) that the character set on the database is utf8mb4. hmm... Looking for ways to correct that.
Larry
Re: utf8 warning at installation step 4
Posted: Wed Mar 09, 2022 7:38 pm
by lwescott
Hi,
When I do
'SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation' FROM information_schema.SCHEMATA;'
It shows that my formalms database is UTF8 with collation utf8_general_ci...
But the result of the query 'show variables like 'character_set_database' returns a value of 'utf8mb3'
(my previous post was incorrect)
Thanks,
Larry
Re: utf8 warning at installation step 4
Posted: Wed Mar 09, 2022 7:49 pm
by alfa24
The installer wants character_set_database variable to be utf8, not utf8mb3.
You may bypass it in /install/controllers/Step4Controller.php, function checkDBCharset
Re: utf8 warning at installation step 4
Posted: Wed Mar 09, 2022 9:15 pm
by lwescott
Hi,
I adjusted the function and was able to get past the problem. THANK YOU for your help!
Not critical, but do you any idea why that the page for Step 7 comes up in Italian?
I was able to complete the install, so you saved me and I really appreciate your willingness to help.
I am able to log into the system now.
Thanks!!
Larry Wescott
Re: utf8 warning at installation step 4
Posted: Thu Mar 10, 2022 6:38 am
by alfa24
I don't remember of your issue, but I didn't find anything in the code. I searched for hardcoded Italian (Forma developers are Italian, as I am) with no apparent luck. If you can post a screenshot, I can confirm. Otherwise, let's wait my next install for a customer
Re: utf8 warning at installation step 4
Posted: Thu Mar 10, 2022 1:01 pm
by lwescott
Here is the screenshot.
Re: utf8 warning at installation step 4
Posted: Thu Mar 10, 2022 1:58 pm
by alfa24
Some Italian keys have been inserted in all other languages files for installer.
You can fix in /lib/installer/lang/english.php for English language.
Re: utf8 warning at installation step 4
Posted: Thu Apr 06, 2023 6:58 pm
by tmasssfd
In case anyone has the same issue and does not know how to edit the code, here is a quick breakdown:
Replace the code in the file: /install/controllers/Step4Controller.php (starting at line 73)
if ($this->checkDBEmpty($db_name)) {
if ($this->checkDBCharset()) {
if ($this->checkStrictMode()) {
--$err;
array_push($res['ok'], 'db_host', 'db_name', 'db_user', 'db_pass', 'db_type');
} else {
array_push($res['err'], 'db_host');
array_push($res['ok'], 'db_name', 'db_user', 'db_pass', 'db_type');
$res['msg'] = Lang::t('_SQL_STRICT_MODE_WARN');
}
} else {
array_push($res['err'], 'db_name');
array_push($res['ok'], 'db_host', 'db_user', 'db_pass', 'db_type');
$res['msg'] = Lang::t('_DB_NOT_UTF8');
}
} else {
array_push($res['err'], 'db_name');
array_push($res['ok'], 'db_host', 'db_user', 'db_pass', 'db_type');
$res['msg'] = Lang::t('_DB_NOT_EMPTY');
}
with this code:
if ($this->checkDBEmpty($db_name)) {
if ($this->checkStrictMode()) {
--$err;
array_push($res['ok'], 'db_host', 'db_name', 'db_user', 'db_pass', 'db_type');
} else {
array_push($res['err'], 'db_host');
array_push($res['ok'], 'db_name', 'db_user', 'db_pass', 'db_type');
$res['msg'] = Lang::t('_SQL_STRICT_MODE_WARN');
}
} else {
array_push($res['err'], 'db_name');
array_push($res['ok'], 'db_host', 'db_user', 'db_pass', 'db_type');
$res['msg'] = Lang::t('_DB_NOT_EMPTY');
}
Hope this helps.