<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>Fatal error in /include/db/mysql/mysqli.php</title>
        <description> Dear Phorum developers.

I have moved one of my Phorum installations to a new place and now I always run into this error:

[code=&amp;quot;php&amp;quot;]

&amp;lt;b&amp;gt;Fatal error&amp;lt;/b&amp;gt;:  Uncaught mysqli_sql_exception: Duplicate entry &amp;#039;hooks&amp;#039; 
for key &amp;#039;P5_iC_settings.PRIMARY&amp;#039; in 
/&amp;lt;myserver&amp;gt;/phorum/include/db/mysql/mysqli.php:149
[/code]

mysqli.php, line 149, reads:

[code=&amp;quot;php&amp;quot;]
$res = mysqli_query($conn, $sql);
[/code]

How can I fix this issue?</description>
        <link>https://www.phorum.org/support/read.php?61,162761,162761#msg-162761</link>
        <lastBuildDate>Fri, 14 Aug 2026 10:17:29 -0500</lastBuildDate>
        <generator>Phorum 6.0.4</generator>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162784#msg-162784</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162784#msg-162784</link>
            <description><![CDATA[ Thanks for your honest and quick reply, Scott. I totally understand this.<br />
<br />
But I cannot go back to older PHP versions for several reasons.<br />
<br />
I&#039;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).<br />
<br />
Best, Ulf]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Tue, 22 Oct 2024 13:14:01 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162783#msg-162783</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162783#msg-162783</link>
            <description><![CDATA[ Back before covid, I was going to go through the code and fix the issues with php 8.x. <br />
   Due to family medical issues, that was put on hold, where it remains.<br />
<br />
[<a href="https://www.a2hosting.com/" target="_blank"  rel="nofollow">www.a2hosting.com</a>]   Still offers older versions of php. <br />
   This phorum is hosted with A2.]]></description>
            <dc:creator>Scott Finegan</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Fri, 18 Oct 2024 08:35:03 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162782#msg-162782</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162782#msg-162782</link>
            <description><![CDATA[ Thank you, Scott. I checked everything with my phpmyadmin maintenance tools and it reports that all tables are fine so far.<br />
<br />
I guess I&#039;m lost using PHORUM with PHP 8 as long as no developers are maintaining the PHORUM source code any longer.]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Fri, 18 Oct 2024 01:42:49 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162781#msg-162781</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162781#msg-162781</link>
            <description><![CDATA[ Please note, I have not used these is several years, so I don&#039;t know what is up to date.<br />
<br />
Mysql workbench  manual  [<a href="https://dev.mysql.com/doc/workbench/en/" target="_blank"  rel="nofollow">dev.mysql.com</a>]<br />
phpmyadmin   third party   [<a href="https://www.phpmyadmin.net/" target="_blank"  rel="nofollow">www.phpmyadmin.net</a>]<br />
<br />
There may be others...   Google      mysql utilities<br />
<br />
Some hosts make phpmyadmin available in the website control console.]]></description>
            <dc:creator>Scott Finegan</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Thu, 17 Oct 2024 17:29:11 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162780#msg-162780</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162780#msg-162780</link>
            <description><![CDATA[ <blockquote class="bbcode"><div><small>Quote<br /></small><strong>Scott Finegan</strong><br />Try rebuilding the tables using mysql maintenance utility.</div></blockquote>
<br />
Where do I find the mentioned mysql maintenance utility, please?]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Thu, 17 Oct 2024 10:38:49 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162777#msg-162777</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162777#msg-162777</link>
            <description><![CDATA[ Thank you for your detailed reply.<br />
<br />
I only have one &#039;hooks&#039; row and the &#039;describe phorum_settings&#039; command shows data as mentioned by you. So I guess my issue sticks somewhere else. What else could I try instead?]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Mon, 14 Oct 2024 03:01:59 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162775#msg-162775</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162775#msg-162775</link>
            <description><![CDATA[ Try<br />
<pre class="bbcode">
MariaDB [phorum]&gt; select * from phorum_settings where name = &#039;hooks&#039;;</pre>
If you get more than one row, something has gone very wrong with your database. In that case try <br />
<pre class="bbcode">
MariaDB [phorum]&gt; describe phorum_settings;</pre>
Column &#039;name&#039; should be Null=NO, Key=PRI. If Key=PRI is missing, it explains how you could get more than one row with name=hooks. <br />
<br />
Check the data column of your &#039;hooks&#039; rows and compare them to one-another. That might reveal where they came from. <br />
<br />
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 &#039;hooks&#039;, 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.]]></description>
            <dc:creator>zenon</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Sat, 28 Sep 2024 06:04:35 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162767#msg-162767</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162767#msg-162767</link>
            <description><![CDATA[ I found a solution myself and like to share it with others:<br />
<br />
- Because I had no chance to access my Phorum&#039;s admin interface, I simply renamed the mods folder on my server to mods_OFF. That didn&#039;t help in the first place.<br />
<br />
Then I emptied the whole cache folder and voilà - the Phorum pages showed up properly again.<br />
<br />
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):<br />
<br />
<ul><li> bbcode_OFF (2.0.12) </li><li> event_logging_OFF_SLOW (5.2.13) </li><li> filelist_OFF_SLOW (1.1.4) </li><li> onlineusers_OFF (2.4.3) </li><li> spamhurdles_OFF (2.0.2) </li></ul>
<br />
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.<br />
<br />
I still cannot access the Phorum&#039;s admin page again, no matter if I have any mods activated or not. This is the current error list:<br />
<br />
[code=&quot;php&quot;]<br />
&lt;b&gt;Fatal error&lt;/b&gt;:  Uncaught mysqli_sql_exception: <br />
Duplicate entry &#039;hooks&#039; for key &#039;phorum_settings.PRIMARY&#039; in /phorum/include/db/mysql/mysqli.php:149<br />
Stack trace:<br />
#0 /phorum/include/db/mysql/mysqli.php(149): mysqli_query()<br />
#1 /phorum/include/db/mysql.php(426): phorum_db_interact()<br />
#2 /phorum/include/api/modules.php(492): phorum_db_update_settings()<br />
#3 /phorum/include/admin/header.php(174): phorum_api_modules_save()<br />
#4 /phorum/admin.php(108): include_once(&#039;...&#039;)<br />
#5 {main}<br />
  thrown in &lt;b&gt;/phorum/include/db/mysql/mysqli.php&lt;/b&gt; on line &lt;b&gt;149&lt;/b&gt;<br />
[/code]<br />
<br />
Best, UIf]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Mon, 22 Jul 2024 05:34:14 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162763#msg-162763</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162763#msg-162763</link>
            <description><![CDATA[ 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.<br />
<br />
This is the whole error message: <br />
<br />
[code=&quot;html4strict&quot;]<br />
&lt;!--<br />
Fatal error:  Uncaught mysqli_sql_exception: Duplicate entry `hooks´ for key `phorum_settings.PRIMARY´ in /phorum/include/db/mysql/mysqli.php:149<br />
Stack trace:<br />
#0 /phorum/include/db/mysql/mysqli.php(149): mysqli_query()<br />
#1 /phorum/include/db/mysql.php(426): phorum_db_interact()<br />
#2 /phorum/include/api/modules.php(492): phorum_db_update_settings()<br />
#3 /phorum/include/admin/header.php(174): phorum_api_modules_save()<br />
#4 /phorum/admin.php(108): include_once(...)<br />
#5 {main}<br />
  thrown in /phorum/include/db/mysql/mysqli.php on line 149<br />
--&gt;<br />
[/code]<br />
<br />
I did <b>not</b> manipulate any Phorum database tables or data myself already.<br />
<br />
Please help.]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Thu, 13 Jun 2024 08:20:51 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162762#msg-162762</guid>
            <title>Re: Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162762#msg-162762</link>
            <description><![CDATA[ Backup the database.<br />
<br />
<blockquote class="bbcode"><div><small>Quote<br /></small><strong></strong><br />Duplicate entry &#039;;hooks&#039;; <br />
for key &#039;;P5_iC_settings.PRIMARY&#039;;</div></blockquote>
      I believe a primary key must be &quot;unique&quot; entry.<br />
<br />
Disable mods and see if the issue goes away.<br />
Turn the mods back on one at a time and test.<br />
Try rebuilding the tables using mysql maintenance utility.]]></description>
            <dc:creator>Scott Finegan</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Fri, 20 Oct 2023 13:03:12 -0500</pubDate>
        </item>
        <item>
            <guid>https://www.phorum.org/support/read.php?61,162761,162761#msg-162761</guid>
            <title>Fatal error in /include/db/mysql/mysqli.php</title>
            <link>https://www.phorum.org/support/read.php?61,162761,162761#msg-162761</link>
            <description><![CDATA[ Dear Phorum developers.<br />
<br />
I have moved one of my Phorum installations to a new place and now I always run into this error:<br />
<br />
[code=&quot;php&quot;]<br />
<br />
&lt;b&gt;Fatal error&lt;/b&gt;:  Uncaught mysqli_sql_exception: Duplicate entry &#039;hooks&#039; <br />
for key &#039;P5_iC_settings.PRIMARY&#039; in <br />
/&lt;myserver&gt;/phorum/include/db/mysql/mysqli.php:149<br />
[/code]<br />
<br />
mysqli.php, line 149, reads:<br />
<br />
[code=&quot;php&quot;]<br />
$res = mysqli_query($conn, $sql);<br />
[/code]<br />
<br />
How can I fix this issue?]]></description>
            <dc:creator>Ulf Dunkel</dc:creator>
            <category>Phorum Support</category>
            <pubDate>Thu, 19 Oct 2023 08:31:59 -0500</pubDate>
        </item>
    </channel>
</rss>
