by Gerry F.
Everything was working fine until I got to one of my teacher's courses and they all threw the "Error writing to database" error with the following:
More info from the PHP Error log file:
I thought this might be an upgrade issue but when I tried to restore one of the same backups on the original server:
I"m restoring courses into a new server with a fresh install of Moodle:
Windows Server
Added SSL Certificate for new server.
Everything was working fine until I got to one of my teacher's courses and they all threw the "Error writing to database" error with the following:
Debug info: MySQL server has gone away
INSERT INTO mdl_backup_controllers (backupid,operation,type,itemid,format,interactive,purpose,userid,status,execution,executiontime,checksum,controller,timecreated,timemodified) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
0 => '6da88cfd9d11a4a5586611d789b17cd1',
1 => 'restore',
2 => 'course',
3 => 52,
4 => 'moodle2',
5 => 1,
6 => 10,
7 => '2',
8 => 500,
9 => 1,
10 => 0,
11 => '8b30a6699b12b826fd4caa411c79927e',
12 => (This string of characters is a mile long so will post if needed)
13 => 1657198419,
14 => 0,
)]
Error code: dmlwriteexception
×Stack trace:
line 489 of \lib\dml\moodle_database.php: dml_write_exception thrown
line 1357 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1403 of \lib\dml\mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
line 87 of \backup\util\dbops\restore_controller_dbops.class.php: call to mysqli_native_moodle_database->insert_record()
line 479 of \backup\controller\restore_controller.class.php: call to restore_controller_dbops::save_controller()
line 167 of \backup\util\ui\base_ui.class.php: call to restore_controller->save_controller()
line 156 of \backup\restore.php: call to base_ui->save_controller()
INSERT INTO mdl_backup_controllers (backupid,operation,type,itemid,format,interactive,purpose,userid,status,execution,executiontime,checksum,controller,timecreated,timemodified) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
[array (
0 => '6da88cfd9d11a4a5586611d789b17cd1',
1 => 'restore',
2 => 'course',
3 => 52,
4 => 'moodle2',
5 => 1,
6 => 10,
7 => '2',
8 => 500,
9 => 1,
10 => 0,
11 => '8b30a6699b12b826fd4caa411c79927e',
12 => (This string of characters is a mile long so will post if needed)
13 => 1657198419,
14 => 0,
)]
Error code: dmlwriteexception
×Stack trace:
line 489 of \lib\dml\moodle_database.php: dml_write_exception thrown
line 1357 of \lib\dml\mysqli_native_moodle_database.php: call to moodle_database->query_end()
line 1403 of \lib\dml\mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
line 87 of \backup\util\dbops\restore_controller_dbops.class.php: call to mysqli_native_moodle_database->insert_record()
line 479 of \backup\controller\restore_controller.class.php: call to restore_controller_dbops::save_controller()
line 167 of \backup\util\ui\base_ui.class.php: call to restore_controller->save_controller()
line 156 of \backup\restore.php: call to base_ui->save_controller()
More info from the PHP Error log file:
[07-Jul-2022 07:53:39 America/Chicago] instantiating restore controller 6da88cfd9d11a4a5586611d789b17cd1
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 100
[07-Jul-2022 07:53:39 America/Chicago] loading backup info
[07-Jul-2022 07:53:39 America/Chicago] loading controller plan
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 300
[07-Jul-2022 07:53:39 America/Chicago] applying restore defaults
[07-Jul-2022 07:53:39 America/Chicago] Unknown setting: questionbank
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 400
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 500
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] saving controller to db
[07-Jul-2022 07:53:39 America/Chicago] calculating controller checksum 8b30a6699b12b826fd4caa411c79927e
[07-Jul-2022 07:53:39 America/Chicago] Default exception handler: Error writing to database Debug: MySQL server has gone away
which is followed by the above info.
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 100
[07-Jul-2022 07:53:39 America/Chicago] loading backup info
[07-Jul-2022 07:53:39 America/Chicago] loading controller plan
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 300
[07-Jul-2022 07:53:39 America/Chicago] applying restore defaults
[07-Jul-2022 07:53:39 America/Chicago] Unknown setting: questionbank
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 400
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] setting controller status to 500
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] checking plan security
[07-Jul-2022 07:53:39 America/Chicago] saving controller to db
[07-Jul-2022 07:53:39 America/Chicago] calculating controller checksum 8b30a6699b12b826fd4caa411c79927e
[07-Jul-2022 07:53:39 America/Chicago] Default exception handler: Error writing to database Debug: MySQL server has gone away
which is followed by the above info.
I thought this might be an upgrade issue but when I tried to restore one of the same backups on the original server:
Windows Server
NO SSL Certificate
Moodle 3.11+ (Build: 20210611)
mysql 5.7.34
php 7.4.10
mysql 5.7.34
php 7.4.10
I received the same exact error with exception of identifying character strings, 0 =>, 11 =>, & 12 => from above.
I looked at the one particular course I was working with and this teacher only used the Assignment Activity type where she links to external resources.
Thank you for any point in the right direction.