Language customisation Error writing to database

Language customisation Error writing to database

by Eamon dwe -
Number of replies: 6

Dear Team 

Moodle 4.0.4, php 8 , server Ubuntu .

I would appreciate if you please help , I am getting error ( Error writing to database) when Language customization //open langue pack for editing , I can NOT open any langue pack for editing. 

I read all Moodle support/documentation , increased max_allowed_packet=100M

also deleted H5P and all related plugin with no success 

below are error 

image1


Best Regards

Eamon....


Attachment tutor1.png
Average of ratings: -
In reply to Eamon dwe

Re: Language customisation Error writing to database

by Randy Thornton -
Picture of Documentation writers
In reply to Randy Thornton

Re: Language customisation Error writing to database

by Eamon dwe -
Dear Randy
Many thanks for your email and support

I tried to fix the data base as you advised
command
$ php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
I’ve got the error is below

******PHP has not been properly configured with the MySQLi extension for it to communicate with MySQL. Please check your php.ini file or recompile PHP.******

#Note
1- 'utf8mb4_unicode_ci', added to config.php
2- Also change my.cnf and added below


1- 'utf8mb4_unicode_ci', added to config.php
2- Also change my.cnf and added below
3- [client]
4- default-character-set = utf8mb4
5-
6- [mysqld]
7- innodb_file_format = Barracuda
8- innodb_file_per_table = 1
9- innodb_large_prefix = true
10-
11- character-set-server = utf8mb4
12- collation-server = utf8mb4_unicode_ci
13- skip-character-set-client-handshake
14-
15- [mysql]
16- default-character-set = utf8mb4


I appreciate your support and suggestions
Best Regards
In reply to Eamon dwe

Re: Language customisation Error writing to database

by Randy Thornton -
Picture of Documentation writers
Did you do what it suggested, check your php.ini file?

The error is likely being generated because you have one version of PHP for Moodle and are calling another version of PHP at the command line. You can check this by running PHP -v at the command line and comparing it to what is in the Site admin > Server > PHP info. You should always run the same version of PHP at the command line that your Moodle is actually using.

If you search the forums here for the error message "*PHP has not been properly configured with the MySQLi extension for it to communicate with MySQL" you will get more details on how to check up on that.

Once that issue is solved, then run the tool to update the collation.
Average of ratings: Useful (1)
In reply to Eamon dwe

Re: Language customisation Error writing to database

by Carolina Blackman -
Hi!

I had the same error (actually posted an hour ago about it) and fix it by changing the DB collation on the mdl_tool_customlang from utf8_unicode_ci to utf8mba_unicode_ci, and also, changed the collation in my config file.



Average of ratings: Useful (1)
In reply to Carolina Blackman

Re: Language customisation Error writing to database

by Robert Clark -

Thanks. This fixed my problem. Could not ALTER stringid (got error about 1 entry being too long) but seems to work  OK now.


In reply to Robert Clark

Re: Language customisation Error writing to database

by Carolina Blackman -
Yas!!!

I'm glad to read that!

Important note: Try to create a user; sometimes you get issues saving users when you change the collation, but... if you already configured your customized language strings, you can go back to the original one that is compatible with your hosting.