Database Error

Started by ryan_dwight, February 26, 2019, 01:29:54 PM

Previous topic - Next topic

ryan_dwight

i got this error when I tried forum maintenance using Find and repair any errors. I attached the error txt file for the result then when I clicked fix, I got this error.

Database Error
Field 'add_authors' doesn't have a default value
File: /home/ptcb/public_html/Sources/RepairBoards.php
Line: 1486

Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.15, while your database is at version 2.0.6. The above error might possibly go away if you execute the latest version of upgrade.php.

Then when I try to upgrade using the large file, it became like this

Database Error
Field 'add_authors' doesn't have a default value
File: /home/ptcb/public_html/Sources/RepairBoards.php
Line: 1486


i also attached the repairboards.php

Thank you in advance

Kindred

it's not a php error, it's a mysql error.


give the add_authors column a default value in mySQL (use phpmyadmin)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ryan_dwight

Thank you for the quick reply Kindred

Would you be so kind if you tell me how to do that. thank you

Kindred

go to phpmyadmin
find the column



https://stackoverflow.com/questions/39674404/mysql-1364-field-column-name-doesnt-have-a-default-value-cant-insert-in
Quote
t means you have 2 options:

    -- Mark your field as NULL (first check if your field is required to have some value or not).

    ALTER TABLE your_table CHANGE COLUMN your_field your_field VARCHAR(250) NULL;

    -- Add a default value to the field so if no data is provided on insert, it will put something you defined. For example:

    ALTER TABLE your_table CHANGE COLUMN your_field your_field VARCHAR(250) NOT NULL DEFAULT 'some_default_value';

    And ofcourse match your field type to the field your are going to change.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Doug Heffernan

Quote from: ryan_dwight on February 26, 2019, 02:11:28 PM
Thank you for the quick reply Kindred

Would you be so kind if you tell me how to do that. thank you

Copy/paste this sql query to the SQL Box of your phpmyadmin, or whatever tool you are using to manage the database.

ALTER TABLE smf_topics CHANGE add_authors add_authors NULL;


ryan_dwight

thank you for the help doug_ips

I got this error
SQL query:

ALTER TABLE smf_topics CHANGE add_authors add_authors NULL

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1


Is there a problem on the new version?

vbgamer45

No, you have set the date type. What data type was add_authors in the table? You can look under table structure for smf_topics
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight

Thank you for the reply cbgamer45

18    add_authors    text    utf8_general_ci       No    None    

on the type column "text"

vbgamer45

Change your sql to
ALTER TABLE smf_topics CHANGE add_authors add_authors text NULL;
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight

the error was gone on the forum maintenance but on the main site as a guest

Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

vbgamer45

Check your forum's error log to see if you can find the error.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight


vbgamer45

Under admin -> Security and Moderation make sure enable error logging is enabled
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

ryan_dwight


Kindred

sounds like you have a bad mod
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ryan_dwight

i think there is much of a problem.

the image is on the lower part of forum maintenance

I tested on default theme

Sir Osis of Liver

You should have just edited the field in phpmyadmin, not used a query.  You may have damaged the database.  Try connecting the db to a clean install.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Quote from: Sir Osis of Liver on February 26, 2019, 04:50:56 PM
You should have just edited the field in phpmyadmin, not used a query.  You may have damaged the database.  Try connecting the db to a clean install.


All phpMyAdmin would have done is run that query.

However the issues shown above are not consistent with a database fault, something else is very wrong.

Sir Osis of Liver

PMA would have run the query correctly, it's not always safe to assume that a poster with limited experience would do the same.  If db runs ok connected to clean install, then it's something else.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ryan_dwight

how can I run the db to a clean install. I have limited experience on this. Your help is much appreciated.

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Doug Heffernan

Quote from: Sir Osis of Liver on February 26, 2019, 04:50:56 PM
You should have just edited the field in phpmyadmin, not used a query.  You may have damaged the database.  Try connecting the db to a clean install.

For an unexperienced someone it is better to run a sql query than doing what you suggest. Editing the database directly is more likely to damage the database in this case.

Anyways, I agree with Arantor, something else could be the culprit here by the looks of it.

To the OP, download the upgrade package of Smf of the version that you are using, remove the upgrade files from it and then upload them inside your forum directory and make sure to overwrite your forum folders/files. This will uninstall all mods that you might have installed, or whatever leftovers might be from previous mods. After you do this have a look and see if the issue will be fixed or not.

ryan_dwight

I will try to backup home dir first, then I will do that.

the site is pinoycyberkada.com

Illori

have you checked your server error log to see if it has anything?

ryan_dwight

[Wed Feb 27 09:26:04.233569 2019] [core:crit] [pid 12069] (13)Permission denied: [client 208.85.211.218:36932] AH00529: /home/ptcb/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/ptcb/public_html/' is executable
[Wed Feb 27 04:19:06.520830 2019] [core:crit] [pid 13215] (13)Permission denied: [client 138.246.253.5:49839] AH00529: /home/ptcb/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/ptcb/public_html/' is executable
[Tue Feb 26 10:41:30.857529 2019] [core:crit] [pid 11418] (13)Permission denied: [client 60.217.72.12:42131] AH00529: /home/ptcb/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/ptcb/public_html/' is executable
[Mon Feb 25 07:44:47.453127 2019] [core:crit] [pid 31515] (13)Permission denied: [client 100.25.3.1:46384] AH00529: /home/ptcb/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/ptcb/public_html/' is executable
[Mon Feb 25 07:35:20.751195 2019] [core:crit] [pid 30774] (13)Permission denied: [client 60.217.72.12:55402] AH00529: /home/ptcb/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/ptcb/public_html/' is executable
[Mon Feb 25 06:49:35.539454 2019] [core:crit] [pid 24330] (13)Permission denied: [client 61.219.11.152:64644] AH00529: /home/ptcb/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/ptcb/public_html/' is executable

I found this

ryan_dwight

Database error is gone.

Now I experiencing white screen most of the time, I can't change theme. when I install Simpleportal and click redirect it was white screen.

Kindred

If your server is configured in any logic way, there will be a server error log for the white screen
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

drewactual

what is the permission's set on the htaccess file?

are you in a shared environment?  has suexec been turned on or off by the host?

Sir Osis of Liver

Forum is offline.  Have you tried removing .htaccess?


Quote from: doug_ips on February 27, 2019, 01:43:08 AM
For an unexperienced someone it is better to run a sql query than doing what you suggest. Editing the database directly is more likely to damage the database in this case.

Having worked on many damaged forums, I disagree.  You're editing the db directly in either case, and it's more likely to damage the db using an incorrect query.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Doug Heffernan

Quote from: Sir Osis of Liver on February 27, 2019, 11:08:49 AM

Quote from: doug_ips on February 27, 2019, 01:43:08 AM
For an unexperienced someone it is better to run a sql query than doing what you suggest. Editing the database directly is more likely to damage the database in this case.

Having worked on many damaged forums, I disagree.  You're editing the db directly in either case, and it's more likely to damage the db using an incorrect query.

No, it is not the same thing. Of ourse you can damage the database if you run incorrect/wrong sql queries, but in this case the queries posted would not cause any damage, but fix the issue. And it is a much better option than editing the field directly.



Sir Osis of Liver

Quote from: ryan_dwight on February 26, 2019, 03:02:19 PM
I got this error
SQL query:

ALTER TABLE smf_topics CHANGE add_authors add_authors NULL

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL' at line 1

If the posted query is correct (sometimes it isn't), and OP applies it correctly (sometimes they don't, as in this case), everything's fine.  If the query is screwed up and mysql is able to execute it, result can be unpredictable.  This may be simple for you, but to someone who's never done it, not so much.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ryan_dwight

Can I try this option?

I will fresh install then i will use my old database.
install all mods that is important.

then on home directory what are the needed folders?

I hope that makes sense.

Kindred

your problem is NOT in any of the files.  There is no need to replace files and replacing files will have absolutely no effect.

Your problem is that the MOD added a column and did not give it a default value.
the ONLY way to fix that is to CORRECTLY set a default (either NULL or NOT NULL with a defined type and value)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

ryan_dwight

I made that already, setting null as default value

drewactual

Quote[Mon Feb 25 06:49:35.539454 2019] [core:crit] [pid 24330] (13)Permission denied: [client 61.219.11.152:64644] AH00529: /home/ptcb/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that '/home/ptcb/public_html/' is executable

Quote from: Sir Osis of Liver on February 27, 2019, 11:08:49 AM
Forum is offline.  Have you tried removing .htaccess?

Quote from: drewactual on February 27, 2019, 10:46:23 AM
what is the permission's set on the htaccess file?

are you in a shared environment?  has suexec been turned on or off by the host?

suexec allows apache to execute under expanded credentials, as an explanation meant for simplicity's sake.   even if you didn't alter permission's or perhaps if a script altered permissions your htaccess ought to be readable unless it's not... and if the permissions haven't been changed by you or by a script, an explanation is possibly suexec being toggled either on or off inadvertently by you or your hosting- making it unreadable by anything but a specific user depending on it's state (on/off).   

the database stuff spoken of is over my head and better left to experts here, but the htaccess not being read pretty much has to be solved before anything constructive can be done for your recovery.

ryan_dwight

Can somebody help me and I will just pay him/her. I might worsen the problem if I will continue at this point. Can I pm someone for this problem?


Sir Osis of Liver

PM access to your host account, I'll have a look.  Do you have a database backup from before you started messing with it?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ryan_dwight

I got the site working but there are some topics that are empty. But if i check on the database table, the content are there.

Sir Osis of Liver

Just did some repairs on this forum, seems to be working ok, but it's not logging any errors (it should be), neither is the server (it was earlier today).  Forum error logging is enabled.  Forum is old and shaggy (like Sir Osis), lot of mods, currently 1193 Guests, 278 Users (100 Spiders), should at least be logging user errors (it doesn't).  Haven't a clue.

Version Information:
Forum version: SMF 2.0.15
Current SMF version: SMF 2.0.15
GD version: bundled (2.1.0 compatible)
Database Server: MariaDB
MySQL version: 10.3.13-MariaDB
PHP: 5.6.40
Server version: Apache
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ryan_dwight

I appreciate the help sir Osis.

Still error log is not working or no errors found

drewactual

is there an apache mod present that mitigates load and if so how is it setup?

likewise, how is SMF's load balancer's set?

what MPM is he running? 

Sir Osis of Liver

Just set up a clean 2.0.15 test install, logs errors normally.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Quote from: Sir Osis of Liver on March 04, 2019, 10:12:19 PM
Just set up a clean 2.0.15 test install, logs errors normally.


On the same hosting environment?

Sir Osis of Liver

Yes, it's in a subirectory, production forum is in root.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor

Any differences of .htaccess files?

Sir Osis of Liver

Test forum has no .htaccess, prod forum has remnant -



RewriteEngine on



Doesn't help to remove it.  Also disabled mod_security, no change.  There's a .htaccess above public_html, contains php ini directives.


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Arantor


Sir Osis of Liver



# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php5_module>
   php_flag asp_tags Off
   php_flag display_errors On
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
   php_value upload_max_filesize 2M
   php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
   php_flag asp_tags Off
   php_flag display_errors On
   php_value max_execution_time 30
   php_value max_input_time 60
   php_value max_input_vars 1000
   php_value memory_limit 128M
   php_value post_max_size 8M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php56"
   php_value upload_max_filesize 2M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: