Error updating 3.1.7 to 4.0.10

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Error updating 3.1.7 to 4.0.10

Post by KT_ »

I've been using phpMyFAQ for many years, and try to upgrade regularly. Usually it goes (relatively) smoothly, aside of a few tweaks and bit of debugging here and there. But today I'm running into difficulty updating from 3.1.7 to 4.0.10.

I'm getting an error in update.js, at: await fetch("../api/setup/check"...
Screenshot 2025-08-29 at 3.04.17 PM.png
It's resulting in a 500 error for 'check':
Screenshot 2025-08-29 at 3.04.31 PM.png
I've got RewriteBase configured properly in .htaccess. (My installation is at myserver.com/kb/, so it's RewriteBase /kb/) It's properly routing /update, so I assume it's working. So I'm at a loss as to why it's not able to find /check, when .htaccess has the default:

Code: Select all

RewriteRule ^api/setup/(check|backup|update-database) api/index.php
That hasn't been changed. Am I missing something obvious? (I mean, I'm probably missing something obvious.)
You do not have the required permissions to view the files attached to this post.
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Re: Error updating 3.1.7 to 4.0.10

Post by KT_ »

Actually, when I click on the "check" error in Chrome's Network tab I get:

An error occurred: Unknown column 'twofactor_enabled' in 'field list' at line 311 at /[myserver.com]/kb/src/phpMyFAQ/Database/Mysqli.php

So I guess something is looking for a nonexistent column?
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Re: Error updating 3.1.7 to 4.0.10

Post by KT_ »

I added 'twofactor_enabled' to faquserdata and tried again. This time I got:

Update database failed: Duplicate entry 'layout.enableCookieConsent' for key 'faqconfig.PRIMARY'
Screenshot 2025-08-30 at 12.36.04 PM.png
You do not have the required permissions to view the files attached to this post.
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Re: Error updating 3.1.7 to 4.0.10

Post by KT_ »

I added 'twofactor_enabled' to faquserdata and tried again. This time I got:

Update database failed: Duplicate entry 'layout.enableCookieConsent' for key 'faqconfig.PRIMARY'
Screenshot 2025-08-30 at 12.36.04 PM.png
You do not have the required permissions to view the files attached to this post.
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error updating 3.1.7 to 4.0.10

Post by Thorsten »

Hi,

sorry for the late reply, I was on vacation.

Are you still stuck in the update process?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Re: Error updating 3.1.7 to 4.0.10

Post by KT_ »

I rolled back to my 3.1.7. and restored my database from backup as the db seems to have gotten into an unusable state with the incomplete update.

I tried running the update again at that point but if I remember right I got the first (original) error about the unknown 'twofactor_enabled' so I just left it.

Hope you had a great vacation!
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error updating 3.1.7 to 4.0.10

Post by Thorsten »

Hi,

the column "twofactor_enabled" was introduced with 3.2. Are you still logged in then starting the update process?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Re: Error updating 3.1.7 to 4.0.10

Post by KT_ »

I believe I would have been logged in as I would have just set it to maintenance mode. I'm fairly certain(?) I hadn't updated to 3.2 or later at any point, and the control panel still shows 3.1.7.
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error updating 3.1.7 to 4.0.10

Post by Thorsten »

Hi,

I think I know what happens here, could you please try to do the update without being loggedin?

Thanks in advance.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Re: Error updating 3.1.7 to 4.0.10

Post by KT_ »

That did help, thanks. I was able to upgrade successfully.

However I have a couple of add-on questions that I'm not sure if they're due to something that didn't work properly during the upgrade:


1. The default view of my admin dashboard (i.e., admin/) shows an error:

Code: Select all

phpMyFAQ Fatal error

Uncaught exception: 'mysqli_sql_exception'

Message: 'Table 'mykb.faqinstances' doesn't exist'

Stack trace:

#0 .../kb/src/phpMyFAQ/Database/Mysqli.php(263): mysqli->query('SELECT count(*)...')
#1 .../kb/src/phpMyFAQ/Database/Mysqli.php(196): phpMyFAQ\Database\Mysqli->getOne('SELECT count(*)...')
#2 .../kb/admin/dashboard.php(38): phpMyFAQ\Database\Mysqli->getTableStatus('')
#3 .../kb/admin/index.php(411): require('/home/generalc/...')
#4 {main}
Thrown in '.../kb/src/phpMyFAQ/Database/Mysqli.php' on line 263
Everything else seems to work, though.


2. Apostrophes (ASCII 0x27) are appearing as ' entities, but only, it seems, on the main page. If I click on the article, the article title shows them properly. Did something potentially not get handled properly during upgrading?
Screenshot 2025-09-17 at 1.03.27 AM.png
(I notice on the phpMyFAQ demo, it sort of happens: the title on the main page appears correctly, but the tooltip shows the entity code.)


3. My tags seem to be broken. They are populated correctly, giving the right (I think) number of articles (i.e., 15 results for the "fonts" tag, below). But clicking on a tag shows empty search results:
Screenshot 2025-09-17 at 12.49.22 AM.png
Screenshot 2025-09-17 at 12.49.43 AM.png

Again, I don't know if this is related to the upgrade or something else. (As far as I know they were working properly previously.)

Thanks again for your help getting past the upgrade hurdles.
You do not have the required permissions to view the files attached to this post.
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error updating 3.1.7 to 4.0.10

Post by Thorsten »

Hi,

the "faqinstances" table is nothing new, so your database seems to be corrupted.

I'll check the entity issue and and number of tags issue the next days.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
KT_
Posts: 32
Joined: Tue Nov 21, 2017 5:28 pm

Re: Error updating 3.1.7 to 4.0.10

Post by KT_ »

I recreated the faqinstances and faqinstance_config table based on the demo, and it seems to be loading properly.
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Error updating 3.1.7 to 4.0.10

Post by Thorsten »

Hi,

the issues are fixed for 4.0.12.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply