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

Hi @asmecher,

Yes, thats why i did not find the session_cookie_path in the OJS 2.4.7-1 .

For the 2nd installation also i am trying with the OJS 2.4.7-1 as i am afraid of upgrade how many issues i need to face and the problem is not solving hence not going for the upgrade.

What could be the issue for the following Fatal Error:
Fatal error: Call to a member function getId() on null in C:\xampp\htdocs\ojs2\plugins\generic\customLocale\CustomLocalePlugin.inc.php on line 28

Hi @Umadhar,

Your version of plugins/generic/customLocale/CustomLocalePlugin.inc.php seems to be different from the version included with OJS 2.4.7-1. Is it possible that you’re mixing files from different versions?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I did not mix anything except the public/ and files/ folder, and Just the DB. …

I did a check as following for ayushdhara.in:
-bash-4.2$ php tools/upgrade.php check
MIB search path: /var/www/tangenti/data/.snmp/mibs:/opt/alt/net-snmp/usr/share/snmp/mibs
Cannot find module (DCS3RMT-MIB): At line 1 in (none)
Cannot find module (DCS3FRU-MIB): At line 1 in (none)
Cannot find module (MIB-Dell-10892): At line 1 in (none)
Cannot find module (StorageManagement-MIB): At line 1 in (none)
Code version: 2.4.7.1
Database version: 2.4.7.1
Latest version: 3.0.2.0
A newer version is available:
tag: ojs-3_0_2-0
date: 2017-02-01
info: http://pkp.sfu.ca/ojs/
package: http://pkp.sfu.ca/ojs/download/ojs-3.0.2.tar.gz
patch: N/A

Another check on ijapr.in
-bash-4.2$ php tools/upgrade.php check
MIB search path: /var/www/tangenti/data/.snmp/mibs:/opt/alt/net-snmp/usr/share/snmp/mibs
Cannot find module (DCS3RMT-MIB): At line 1 in (none)
Cannot find module (DCS3FRU-MIB): At line 1 in (none)
Cannot find module (MIB-Dell-10892): At line 1 in (none)
Cannot find module (StorageManagement-MIB): At line 1 in (none)
Code version: 2.4.7.1
Database version: 2.4.7.1
Latest version: 3.0.2.0
A newer version is available:
tag: ojs-3_0_2-0
date: 2017-02-01
info: http://pkp.sfu.ca/ojs/
package: http://pkp.sfu.ca/ojs/download/ojs-3.0.2.tar.gz
patch: N/A

The new installation which i am doing version check as follows and this is on my local machine in xamp server:
php tools/upgrade.php check

(mysql): SET NAMES ‘utf8’


(mysql): SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ‘announcementfeedplugin’ AND journal_id = ‘0’


(mysql): SELECT * FROM versions WHERE current = 1


(mysql): SELECT * FROM versions WHERE current = 1 AND product_type = ‘core’ AND product = ‘ojs2’


(mysql): SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ‘backupplugin’ AND journal_id = ‘0’


(mysql): SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ‘booksforreviewplugin’ AND journal_id = ‘0’


(mysql): SELECT setting_name, setting_value, setting_type FROM plugin_settings WHERE plugin_name = ‘browseplugin’ AND journal_id = ‘0’

PHP Fatal error: Call to a member function getId() on null in C:\xampp\htdocs\ojs2\plugins\generic\customLocale\CustomLocalePlugin.inc.php on line 26

Fatal error: Call to a member function getId() on null in C:\xampp\htdocs\ojs2\plugins\generic\customLocale\CustomLocalePlugin.inc.php on line 26

Not sure what the application is expecting here to be set.

Hi @Umadhar,

What is on line 26 in plugins\generic\customLocale\CustomLocalePlugin.inc.php?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

at 26th Line: $journalId = $journal->getId();

Here is that function code:

function register($category, $path) {
	if (parent::register($category, $path)) {
		if ($this->getEnabled()) {
			// Add custom locale data for already registered locale files.
			$locale = AppLocale::getLocale();
			$localeFiles = AppLocale::getLocaleFiles($locale);
			$journal = Request::getJournal();
			$journalId = $journal->getId();
			$publicFilesDir = Config::getVar('files', 'public_files_dir');
			
			$customLocalePathBase = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR;

			import('lib.pkp.classes.file.FileManager');
			$fileManager = new FileManager();
			foreach ($localeFiles as $localeFile) {
				$customLocalePath = $customLocalePathBase . $localeFile->getFilename();
				if ($fileManager->fileExists($customLocalePath)) {
					AppLocale::registerLocaleFile($locale, $customLocalePath, true);
				}
			}

			// Add custom locale data for all locale files registered after this plugin
			HookRegistry::register('PKPLocale::registerLocaleFile', array(&$this, 'addCustomLocale'));
		}

		return true;
	}
	return false;
}

What could be the issue?

Hi @Umadhar,

I’m afraid this isn’t making much sense to me – your installation is an old, stable version of OJS and it’s now showing two errors that I haven’t seen before. Either something is unusual about your server environment, or something is unusual in the way you’ve installed OJS. Is it possible for you to try on another server environment with a fresh installation?

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher,

Hope you are doing good.

Sorry for not responding till now, i did a try in my local and with new hosting, The issue was gone and it did not show up, As you mentioned earlier, it is with the hosting issue only not sure how, i could not figure it out as i have taken long time to set it up.

I would like to thank you for your continued observation and guidance on this without giving up any point of time.

I will start upgrading to the newer versions soon but i am afraid how many issues i will come across with that activity which i need to do for 3 journal systems. If i come across any issues i will be coming to you again :slight_smile:

Thanks again.

  • Umadhar

me got the htaccess file and how to add php_value session.auto_start 0;
?

hello
can you help me to add php_value session.auto_start 0; in htaccess
mail: pmuhammed707@gmail.com

Hi @P_Muhammed,

This is a question for your service provider – it’s not really related to OJS. You might be able to find some useful information on StackOverflow.com.

Regards,
Alec Smecher
Public Knowledge Project Team

i solved the problem
thanks for your response

I got the same error DB Error: Duplicate entry ‘be226c0ugvgbbglukd5lgj1tm1’ for key ‘sessions_pkey’.I have Checked the Php info it show session auto start off.I also Check the error Log it gives below error

[09-Jun-2018 06:30:40 America/Toronto] ojs2 has produced an error
Message: WARNING: ini_set(): A session is active. You cannot change the session module’s ini settings at this time
In file: /home/jeths103/public_html/lib/pkp/classes/session/SessionManager.inc.php
At line: 38
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.6.36
Apache Version: N/A
DB Driver: mysql
DB server version: 5.5.59-cll
[09-Jun-2018 06:30:40 America/Toronto] NOTICE: A session had already been started - ignoring session_start() (/home/jeths103/public_html/lib/pkp/classes/session/SessionManager.inc.php:60)
[09-Jun-2018 06:30:43 America/Toronto] ojs2 has produced an error
Message: WARNING: array_shift() expects parameter 1 to be array, null given
In file: /home/jeths103/public_html/classes/article/Article.inc.php
At line: 142
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.6.36
Apache Version: N/A
DB Driver: mysql
DB server version: 5.5.59-cll

MY OJS Version is 2.4.5.0.Please Help in this problem

Hi @Sanjeev_Kumar,

I would suggest upgrading if possible – OJS 2.4.5 is by now quite old.

Check further up in your log file to see if there are any more entries from the same time; there might be something else that helps narrow down where the session was created.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

My site worked fine earlier. But it stopped working and showed me the same error. Can you please tell me what’s the issue and how to fix it? My site is http://www.ijsas.com/index.php/ijsas/

Another thing, I got notification from godaddy that the site has some malware files. malware
I have deleted the files, but how can I make the site secure so that it doesn’t happen again.

Thank you.

Hi @anjansid,

Your question isn’t related to this thread – can you post it as a new topic?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I am sorry for the confusion. There are 2 problem in the website.

First I am getting the “DB Error: Duplicate entry ‘xxxxxx’ for key ‘sessions_pkey’” error in my site. Can you please tell me how to fix it?

I will post a new thread for the second part which is related to malware.

Regards

Hi @anjansid,

I suspect the sessions warning will go away when you’ve addressed the malware issue. I’ll watch for that post to show up.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I already cleaned up the files shown by the hosting provider.

I am currently running into some issues deploying OJS (3.1.1.2) on a client server.

OJS runs flawlessly on my DigitalOcean Stagingserver (running PHP 7.2.1), but breaks after a successful installation on the client’s server (running PHP 7.1.19) with a “DB Error: Duplicate entry ‘XXX’ for key ‘sessions_pkey’” error.

As some other users already ran into that problem, i have tried some of the solutions provided here (DB Error: Duplicate entry 'NULL' for key 'sessions_user_id' php 5.5 instead of 5.6 - #6 by stinkjyo) and here (DB Error: Duplicate entry 'xxxxxx' for key 'sessions_pkey' - #16 by asmecher), but to no avail. The session.auto_start is disabled as well.

After truncating the session table, the site loads (until another reload or link happens), but the default theme is broken as well. If is set the session_cookie_path to e.g. /home/XYZ/webdir, the default theme loads properly, but the login just redirects me back to the index page after i have entered my credentials (and doesn’t seem to recognize the sessioncookie)

Thanks in advance.

15
42

Hi dudes, everything ok?

I was facing the same problem this morning. Was a invasion. First of all in my root path appear four new files, x.php w.php yujin.php xonol.php and my index.php was corrupted.

So I delete this files, but first I check on github project if they really don’t are part of system. After I was opened my index.php and on first line has been a encode64 instruction in that check my server and other things, after it I delete the index.php file and download it by the oficial repository on github, no more problems.

For me run like a charm, the session_id on table sessions that was ever created, every time that open the page stop to occur. After all of it is high recommended to check the folder permissions an remove all permissions that was 777 on folders, or something like it.