DB Error: Duplicate entry '' for key 'sessions_pkey'


I have just updated my OJS from to I need to stick to OJS 2.x, but at the same time I have to switch to php 7. The update was successful according to the installer, but entering the website gives the following error: DB Error: Duplicate entry ‘’ for key ‘sessions_pkey’.

I repeated the same procedure locally (XAMPP), on the pre-update (= OJS database version and the system works fine. I read other threads related to similar issue, but none seems to be helpful. I thought this might be related to the DB version? Let me list major components of my live and test environments:


  • Apache 2.4.46
  • PHP 7.3.12
  • MySQL 5.6.38


  • Apache 2.4.46
  • PHP 7.4.12
  • MariaDB 10.4.16

I see the following php error on the live server after entering the website (in the php logs):
[04-May-2021 16:12:21 UTC] ojs2 has produced an error
Message: WARNING: session_start(): Cannot start session when headers already sent
In file: /lib/pkp/classes/session/SessionManager.inc.php
At line: 59 (the same error repeated for other lines too)
Server info:
OS: Linux
PHP Version: 7.3.12
Apache Version: N/A
DB Driver: mysqli
DB server version: 5.6.38


Hi @piotreba

The version of OJS that you’re using is no longer maintained or supported by PKP. I recommend that you upgrade to the newest version of OJS.

You may find the following resources helpful in preparing for and performing the upgrade:

These resources will introduce you to OJS 3 and how it is different from OJS 2:

You may need to seek professional support to upgrade your installation. This can usually be acquired from the service provider that hosts or maintains your software, such as the technical support team at your institution or a third-party hosting provider.

If you are unable to get the support you need from your service provider, we recommend you consider exploring alternative providers. Publishing support services may exist in your institution that can help you identify sources of help. Or you can seek support from commercial service providers, such as PKP Publishing Services.

Israel Cefrin
PKP Team

Just in case anyone needs help on this, the problem seems to be gone after turning off display_errors and the reporting of the following php errors:

Thanks piotreba! Successfully upgraded to version

1 Like