Firefox PHP

Fatal error in /include/db/mysql/mysqli.php

Posted by Ulf Dunkel 
Fatal error in /include/db/mysql/mysqli.php
October 19, 2023 09:31AM
Dear Phorum developers.

I have moved one of my Phorum installations to a new place and now I always run into this error:

Language: PHP
<b>Fatal error</b>: Uncaught mysqli_sql_exception: Duplicate entry ';hooks'; for key ';P5_iC_settings.PRIMARY'; in /<myserver>/phorum/include/db/mysql/mysqli.php:149

mysqli.php, line 149, reads:

Language: PHP
$res = mysqli_query($conn, $sql);

How can I fix this issue?

Regards, Ulf Dunkel
Re: Fatal error in /include/db/mysql/mysqli.php
October 20, 2023 02:03PM
Backup the database.

Quote

Duplicate entry ';hooks';
for key ';P5_iC_settings.PRIMARY';
I believe a primary key must be "unique" entry.

Disable mods and see if the issue goes away.
Turn the mods back on one at a time and test.
Try rebuilding the tables using mysql maintenance utility.
Re: Fatal error in /include/db/mysql/mysqli.php
June 13, 2024 09:20AM
I have no idea how to disable used mods for the phorum as I cannot access any phorum pages on my browser right now. I have access to the MySQL database though.

This is the whole error message:

Language: HTML
<!-- Fatal error: Uncaught mysqli_sql_exception: Duplicate entry `hooks´ for key `phorum_settings.PRIMARY´ in /phorum/include/db/mysql/mysqli.php:149 Stack trace: #0 /phorum/include/db/mysql/mysqli.php(149): mysqli_query() #1 /phorum/include/db/mysql.php(426): phorum_db_interact() #2 /phorum/include/api/modules.php(492): phorum_db_update_settings() #3 /phorum/include/admin/header.php(174): phorum_api_modules_save() #4 /phorum/admin.php(108): include_once(...) #5 {main} thrown in /phorum/include/db/mysql/mysqli.php on line 149 -->

I did not manipulate any Phorum database tables or data myself already.

Please help.

Regards, Ulf Dunkel
Re: Fatal error in /include/db/mysql/mysqli.php
July 22, 2024 06:34AM
I found a solution myself and like to share it with others:

- Because I had no chance to access my Phorum's admin interface, I simply renamed the mods folder on my server to mods_OFF. That didn't help in the first place.

Then I emptied the whole cache folder and voilà - the Phorum pages showed up properly again.

Then I created a new mods folder and copied the mods one by one, checking which ones caused problems. These are the modules I then switched off (by renaming their folders):

  • bbcode_OFF (2.0.12)
  • event_logging_OFF_SLOW (5.2.13)
  • filelist_OFF_SLOW (1.1.4)
  • onlineusers_OFF (2.4.3)
  • spamhurdles_OFF (2.0.2)

Now the Phorum can be accessed again. I have listed my versions of these critical mods just in case someone could explain why these do no longer work with my Phorum installation v 5.2.23.

I still cannot access the Phorum's admin page again, no matter if I have any mods activated or not. This is the current error list:

Language: PHP
<b>Fatal error</b>: Uncaught mysqli_sql_exception: Duplicate entry ';hooks'; for key ';phorum_settings.PRIMARY'; in /phorum/include/db/mysql/mysqli.php:149 Stack trace: #0 /phorum/include/db/mysql/mysqli.php(149): mysqli_query() #1 /phorum/include/db/mysql.php(426): phorum_db_interact() #2 /phorum/include/api/modules.php(492): phorum_db_update_settings() #3 /phorum/include/admin/header.php(174): phorum_api_modules_save() #4 /phorum/admin.php(108): include_once(';...';) #5 {main} thrown in <b>/phorum/include/db/mysql/mysqli.php</b> on line <b>149</b>

Best, UIf

Regards, Ulf Dunkel
Sorry, only registered users may post in this forum.

Click here to login