A database error has occurred: Duplicate entry 'JQueryPlugin-0-enabled' for key 'plugin_settings_pkey'

OK I found the show table command and the database does not have that table in it.

Hi @smithmich,

That table should definitely be present in a healthy OJS 2.3.2 installation. I think you’re running into the situation described on this thread – your database at some point was partially upgraded, but the upgrade failed and the journal continued to operate with the database stranded between the two versions. Do you know the journal’s upgrade history?

Regards,
Alec Smecher
Public Knowledge Project Team

No but I can find out. Is there a way to work through this?

Hi @smithmich,

The “right” way to do this is to restore from backup in the case of a failed upgrade, fix the problem, and then run a complete upgrade before continuing. If an upgrade failed some time ago, as I suspect, then I fear that’s likely off the table – you may not have a backup from that point, and if you do, restoring to it will lose any content added since that point.

If you have a copy of the error message that the earlier upgrade attempt failed with, it may be possible to determine where in the upgrade process the script stopped.

Regards,
Alec Smecher
Public Knowledge Project Team

Can you point me to where I would find the error message? Like I mentioned earlier, the upgrade to version 2.3.2 was successful and I could access the site. It is trying to upgrade to 2.4.8 where it is failing.

Hi @smithmich,

A healthy OJS 2.3.2 installation will contain a database table called article_event_log table. The only reason I can think that it wouldn’t, as per the other thread, is if someone tried to upgrade the install to a newer version (which renames/deletes that table), but the upgrade failed, and the site continued to be used in an inconsistent state after the failed upgrade. Is that a possibility?

Regards,
Alec Smecher
Public Knowledge Project Team

I got a copy of the database that had is supposed to be correct and got passed that error. Now I get this error:
A database error has occurred: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1. I am running mysql version 5.7.17.

Hi @smithmich,

The lack of context in that error message makes it a little difficult to interpret. One way to get more context is to run the upgrade with the “debug” option turned on; this will cause all DB queries to be dumped as they’re executed, and the last one you see should be the problem query. When re-running a failed upgrade, make sure to restore your database and files area first.

If you’re using the web-based upgrade tool, consider using the command-line one instead. It’ll provide more information.

Regards,
Alec Smecher
Public Knowledge Project Team

When I try to run the upgrade.php I get access denied. I am logged in as root. I was reading similar cases and they suggest clearing the cache. Do you know where the cache is located?

Hi @smithmich,

Hmm, you shouldn’t get an “access denied” if you’re running as root. Could you post a screenshot? I’m not sure this is cache-related.

Regards,
Alec Smecher
Public Knowledge Project Team

This is a screen shot. I’m pretty sure the permissions are correct on the upgrade.php file.

Hi @smithmich,

Try running that from the OJS installation directory, rather than the tools subdirectory. (The tools part is already specified in the first parameter to the php binary.)

Make sure, as always, that you’ve got a good backup of your database and files area, and if you hit a problem, capture the output of the upgrade command so you can post it here.

Regards,
Alec Smecher
Public Knowledge Project Team

OK that worked but I got this output.
[root@OJSServer ojs3]# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.4.8.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.3.3_preupdate1.xml]
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1

Hi @smithmich,

Try my earlier suggestion regarding the debug option.

Regards,
Alec Smecher
Public Knowledge Project Team

Which debug options should I turn on and where will the output be?

Hi @smithmich,

The debug option is in the config.inc.php configuration file. While that option is enabled, database queries will be dumped by OJS however it’s executed – either to the website for web-based interaction or on the terminal for terminal-based interaction (as you’re now doing).

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks, I have turned on show_stacktrace and rerun the upgrade.php command. This is the output:
[root@OJSServer ojs3]# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.4.8.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.3.3_preupdate1.xml]
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “assert(): Assertion failed”, “/var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php”, 155, Array(12))
File: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php line 155
Function: assert(False)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 396
Function: DBDataXMLParser->parseData(“dbscripts/xml/upgrade/2.3.3_preupdate1.xml”)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 269
Function: Installer->executeAction(Array(3))
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 190
Function: Installer->executeInstaller()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 87
Function: Installer->execute()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 63
Function: UpgradeTool->upgrade()
File: /var/www/html/ojs3/tools/upgrade.php line 34
Function: UpgradeTool->execute()
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “assert(): Assertion failed”, “/var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php”, 155, Array(12))
File: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php line 155
Function: assert(False)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 396
Function: DBDataXMLParser->parseData(“dbscripts/xml/upgrade/2.3.3_preupdate1.xml”)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 269
Function: Installer->executeAction(Array(3))
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 190
Function: Installer->executeInstaller()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 87
Function: Installer->execute()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 63
Function: UpgradeTool->upgrade()
File: /var/www/html/ojs3/tools/upgrade.php line 34
Function: UpgradeTool->execute()
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
File: (unknown) line (unknown)
Function: PKPApplication->errorHandler(2, “assert(): Assertion failed”, “/var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php”, 155, Array(12))
File: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php line 155
Function: assert(False)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 396
Function: DBDataXMLParser->parseData(“dbscripts/xml/upgrade/2.3.3_preupdate1.xml”)
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 269
Function: Installer->executeAction(Array(3))
File: /var/www/html/ojs3/lib/pkp/classes/install/Installer.inc.php line 190
Function: Installer->executeInstaller()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 87
Function: Installer->execute()
File: /var/www/html/ojs3/lib/pkp/classes/cliTool/UpgradeTool.inc.php line 63
Function: UpgradeTool->upgrade()
File: /var/www/html/ojs3/tools/upgrade.php line 34
Function: UpgradeTool->execute()
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1

Hi @smithmich,

That’s the show_stacktrace option; I was looking for the output from the debug option.

Regards,
Alec Smecher
Public Knowledge Project Team

I set display_errors to On and ran the command. This is the output now.
[root@OJSServer ojs3]# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.4.8.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.3.3_preupdate1.xml]
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql

ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql

ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql

ojs2 has produced an error
Message: WARNING: assert(): Assertion failed
In file: /var/www/html/ojs3/lib/pkp/classes/db/DBDataXMLParser.inc.php
At line: 155
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.16
Apache Version: N/A
DB Driver: mysql
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1

Hi @smithmich,

Sorry, that’s still not the right setting – you need to turn on the debug option. It’s in the [database] section. :slight_smile:

Regards,
Alec Smecher
Public Knowledge Project Team