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 |
Registered: 23 years ago Posts: 156 |
Dear Phorum developers.
I have moved one of my Phorum installations to a new place and now I always run into this error:
mysqli.php, line 149, reads:
How can I fix this issue?
Regards, Ulf Dunkel
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 |
Admin Registered: 19 years ago Posts: 569 |
Re: Fatal error in /include/db/mysql/mysqli.php June 13, 2024 09:20AM |
Registered: 23 years ago Posts: 156 |
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:
I did not manipulate any Phorum database tables or data myself already.
Please help.
Regards, Ulf Dunkel
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 |
Registered: 23 years ago Posts: 156 |
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):
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:
Best, UIf
Regards, Ulf Dunkel
- 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
Re: Fatal error in /include/db/mysql/mysqli.php September 28, 2024 07:04AM |
Registered: 17 years ago Posts: 50 |
Try
Check the data column of your 'hooks' rows and compare them to one-another. That might reveal where they came from.
Once you understand what happened and how, you will have to repair the database without losing data. Your best bet is probably to dump the database (use --extended-insert=FALSE), manually edit the dump to delete the surplus 'hooks', load the edited dump back into the database, add Null=NO, Key=PRI to name if needed, and then attempt to reinstall the mods or reconfigure the settings that appeared in the hooks rows that you deleted from the dump.
MariaDB [phorum]> select * from phorum_settings where name = 'hooks';If you get more than one row, something has gone very wrong with your database. In that case try
MariaDB [phorum]> describe phorum_settings;Column 'name' should be Null=NO, Key=PRI. If Key=PRI is missing, it explains how you could get more than one row with name=hooks.
Check the data column of your 'hooks' rows and compare them to one-another. That might reveal where they came from.
Once you understand what happened and how, you will have to repair the database without losing data. Your best bet is probably to dump the database (use --extended-insert=FALSE), manually edit the dump to delete the surplus 'hooks', load the edited dump back into the database, add Null=NO, Key=PRI to name if needed, and then attempt to reinstall the mods or reconfigure the settings that appeared in the hooks rows that you deleted from the dump.
Re: Fatal error in /include/db/mysql/mysqli.php October 14, 2024 04:01AM |
Registered: 23 years ago Posts: 156 |
Re: Fatal error in /include/db/mysql/mysqli.php October 17, 2024 11:38AM |
Registered: 23 years ago Posts: 156 |
Re: Fatal error in /include/db/mysql/mysqli.php October 17, 2024 06:29PM |
Admin Registered: 19 years ago Posts: 569 |
Please note, I have not used these is several years, so I don't know what is up to date.
Mysql workbench manual [dev.mysql.com]
phpmyadmin third party [www.phpmyadmin.net]
There may be others... Google mysql utilities
Some hosts make phpmyadmin available in the website control console.
Edited 1 time(s). Last edit at 10/17/2024 06:32PM by Scott Finegan.
Mysql workbench manual [dev.mysql.com]
phpmyadmin third party [www.phpmyadmin.net]
There may be others... Google mysql utilities
Some hosts make phpmyadmin available in the website control console.
Edited 1 time(s). Last edit at 10/17/2024 06:32PM by Scott Finegan.
Re: Fatal error in /include/db/mysql/mysqli.php October 18, 2024 02:42AM |
Registered: 23 years ago Posts: 156 |
Re: Fatal error in /include/db/mysql/mysqli.php October 18, 2024 09:35AM |
Admin Registered: 19 years ago Posts: 569 |
Back before covid, I was going to go through the code and fix the issues with php 8.x.
Due to family medical issues, that was put on hold, where it remains.
[www.a2hosting.com] Still offers older versions of php.
This phorum is hosted with A2.
Due to family medical issues, that was put on hold, where it remains.
[www.a2hosting.com] Still offers older versions of php.
This phorum is hosted with A2.
Re: Fatal error in /include/db/mysql/mysqli.php October 22, 2024 02:14PM |
Registered: 23 years ago Posts: 156 |
Thanks for your honest and quick reply, Scott. I totally understand this.
But I cannot go back to older PHP versions for several reasons.
I'd be more than happy if you find some spare time to fix the PHP issues with PHP 8 (hopefully before PHP 9 is released).
Best, Ulf
Regards, Ulf Dunkel
But I cannot go back to older PHP versions for several reasons.
I'd be more than happy if you find some spare time to fix the PHP issues with PHP 8 (hopefully before PHP 9 is released).
Best, Ulf
Regards, Ulf Dunkel
Sorry, only registered users may post in this forum.