Hi all.
I'm running SMF version 2.0.18 on the site http://www.china-defense.com/smf/index.php. The software is returning HTTP 500 errors and the following is in the error_log:
[04-Feb-2025 20:17:53 Etc/GMT+5] PHP Fatal error: Uncaught mysqli_sql_exception: Duplicate entry '16777215' for key 'PRIMARY' in /home2/cdf/public_html/smf/Sources/Subs-Db-mysql.php:1169
Stack trace:
#0 /home2/cdf/public_html/smf/Sources/Subs-Db-mysql.php(1169): mysqli_query(Object(mysqli), '\n\t\t\tINSERT INTO...')
#1 /home2/cdf/public_html/smf/Sources/Subs-Db-mysql.php(1497): SMF_DB_MySQLi->query('', '\n\t\t\tINSERT INTO...', Array, Object(mysqli))
#2 /home2/cdf/public_html/smf/Sources/Errors.php(139): SMF_DB_MySQLi->insert('', 'smf2009_log_err...', Array, Array, Array)
#3 /home2/cdf/public_html/smf/Sources/Errors.php(161): log_error('Duplicate entry...', 'general')
#4 /home2/cdf/public_html/smf/index.php(130): fatal_error('Duplicate entry...', 'general')
#5 [internal function]: {closure}(Object(mysqli_sql_exception))
#6 {main}
Using the phpMyAdmin, I deleted the entry in the smf2009_log_errors with id_error = 16777215. However, every time someone visited the site, the same entry with id_error = 16777215 gets created again and again.
I'm at a lost why this is happening. I couldn't figure out why it is happening. Can you please give me some guidance on how to fix it?
Thank you very much.
Try to change the autoincreament field on the table to a higher id.
Or a quick fix disable error logging. in smf_settings find
enableErrorLogging and set the value to 0
16M errors is a lot... id_error is a MEDIUMINT...
The largest value an unsigned MEDIUMINT can hold is 16,777,215.
I'd probably change it to an INT, & try to figure out where all the errors are coming from.
Thank you very much.
I have ran "alter table smf2009_log_errors auto_increment = 16777216;", didn't help
I have also changed id_error to mediumint(20)
Neither changes helped.
In the Settings.php, there is an entry:
$db_last_error = 1607014351;
Changing it to "$db_last_error = 160701435100000;" and adding "$enableErrorLogging = 0;" didn't help either.
mediumint(20) won't work, it's still a mediumint.
It needs to become an int.
And you need to figure out how you got 16M+ errors.
Quote from: shawnb61 on February 09, 2025, 01:16:26 PMmediumint(20) won't work, it's still a mediumint.
It needs to become an int.
And you need to figure out how you got 16M+ errors.
I just got pulled in to fix the forum :)
Changed the column to int and we are back in business!!! :D
Thank you thank you thank you!!!
is it safe for me to run "delete from smf2009_log_errors"?
This is an example record in the smf2009_log_errors table:
url:
?action=verificationcode;vid=register;rand=<deleted>
message:
8192: imagefilledpolygon(): Using the $num_points parameter is deprecated
file:
/home2/cdf/public_html/smf/Sources/Subs-Graphics.php
line:
917
What PHP version are you on? Also you should up to at least 2.0.19...
Quote from: vbgamer45 on February 09, 2025, 02:17:23 PMWhat PHP version are you on? Also you should up to at least 2.0.19...
Look to be 5.2.1 according to phpMyAdmin help but PHP 8.2 (ea-php82) according to the hosting company's control panel
Can I upgrade to 2.1.4?
Thanks
2.0.18 does not support php 8. Yes, you should upgrade to current version.
Also, clear your error log
Quote from: Kindred on February 09, 2025, 05:14:08 PMAlso, clear your error log
Yup, did that:
delete from smf2009_log_errors;
alter table smf2009_log_errors auto_increment = 0;
Or just use the admin interface to do it.
Doing direct database edits is almost never the right way
Sorry, one more question
Our current forum is on 2.0.18 http://www.china-defense.com/smf/index.php with database table prefix of "smf2009_"
I have installed 2.1.14 https://www.china-defense.com/smf214/index.php with database table prefix of "smf214_"
Is there a guide on how to migrate data from one forum installation to another?
Thank you very very much.
There is no migration involved. SMF supports directly upgrading from one version to another. See https://wiki.simplemachines.org/smf/Upgrading for more information.
Also, putting two instances of smf in the same database is a bad idea, even with different prefixes
Thanks.
Any idea why none of the pictures are showing when using SSL?
http://www.china-defense.com/smf/index.php
https://www.china-defense.com/smf/index.php
Because you used http for the image url?
Quote from: Kindred on February 11, 2025, 06:09:41 PMBecause you used http for the image url?
Is it configured within the SMF or the hosting company?
Thanks.
Whatever you set it to use in smf admin
Quote from: Kindred on February 11, 2025, 09:18:24 PMWhatever you set it to use in smf admin
Would you mind telling me where in the admin I can configure the image URL?
In the Settings.php of the live site, I have
$image_proxy_enabled = true;
$image_proxy_secret = '<some random string';
$image_proxy_maxsize = 5190;
For example I can load the image without SSL after I am logged in:
http://www.china-defense.com/smf/Themes/default/images/boardicons.png
but can't load it in SSL still
https://www.china-defense.com/smf/Themes/default/images/boardicons.png
Thanks
Ok, that's a whole different issue...
the images not showing up when the theme is loaded is usually due to using the wrong URL for the setting
(header logo image, avatars, attachments, themes, etc)
Not being able to load it DIRECTLY via https suggests that you have a badly configured HOST!
Quote from: Kindred on February 12, 2025, 06:34:04 AMOk, that's a whole different issue...
the images not showing up when the theme is loaded is usually due to using the wrong URL for the setting
(header logo image, avatars, attachments, themes, etc)
Not being able to load it DIRECTLY via https suggests that you have a badly configured HOST!
You are absolutely right!!!
I commented out the following line in the .htaccess file and the icons are loaded in SSL
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
Thanks again.