You are viewing the PKP Support Forum | PKP Home Wiki

Mac OSX issue with 2.4.3 - "Cannot redeclare class"

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Mac OSX issue with 2.4.3 - "Cannot redeclare class"

Postby wallygva » Thu Jan 30, 2014 12:29 pm

On 2.4.3 I see this in my error file when trying to view "site settings" under admin account:

NOTICE: Constant OJS_METRIC_TYPE_COUNTER already defined (/volumes/1TB/htdocs/ojs2/plugins/generic/usageStats/UsageStatsReportPlugin.inc.php:19), referer: http://wizwah.gmu.edu/ojs2/index.php/index/admin
[Thu Jan 30 14:11:01 2014] [error] [client] PHP Fatal error: Cannot redeclare class UsageStatsReportPlugin in /volumes/1TB/htdocs/ojs2/plugins/generic/usageStats/UsageStatsReportPlugin.inc.php on line 21, referer: http://wizwah.gmu.edu/ojs2/index.php/index/admin

I have spent many hours trying to figure this out. It was introduced when moving from 2.4.2 to 2.4.3. I've been running patched to current version code but today I did an experiment. I did two fresh installs, one on the Mac OSX 10.8.5 server and one on a RedHat Enterprise 6.3 machine. Put the same OJS database on each system and configured the config.inc.php files similarly. Both systems working well....until I clicked on "Site Settings" under Site Administrator.

Problem *does not* exist on the fresh install Linux machine.
Problem *does* appear on the fresh install Mac.

If I tweak the code on the Mac, changing for example this bit of UsageStatsReportPlugin.inc.php from



if (!defined('OJS_METRIC_TYPE_COUNTER'))
{ define('OJS_METRIC_TYPE_COUNTER', 'ojs::counter');

I can get past the errors but I assume I'm losing functionality somewhere

Any suggestions would be welcomed.

My platform:

O/S: Mac OS Server 10.8.5
PHP: 5.3.8
MySQL: 5.1.72
OJS: 2.4.3

the other machine:

O/S: RedHat 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
PHP: 5.3.3
MySQL: 5.1.66
OJS: 2.4.3
Posts: 10
Joined: Mon May 16, 2011 12:18 pm

Re: Mac OSX issue with 2.4.3 - "Cannot redeclare class"

Postby bbeghelli » Fri Feb 07, 2014 1:21 am

Hi wallygva,

The fatal error that you have is really strange. It happens because the same UsageStatsReportPlugin class is declared twice, but we always include files just one time.

The code you added should only avoid the first NOTICE. Did you managed to avoid the fatal error using the if statement?

Also try to make sure you don't have a duplicate of the UsageStatsReportPlugin class inside your ojs files, maybe with a different case.

Posts: 183
Joined: Tue Jun 25, 2013 2:22 pm

Re: Mac OSX issue with 2.4.3 - "Cannot redeclare class"

Postby wallygva » Fri Feb 07, 2014 12:30 pm

I don't find a duplicate anywhere in the /ojs software tree...

I'm now trying to migrate my OJS installation over to a RedHat box but at the moment I'm stumped on logging in. I've filed a forum post on that issue and while I'm sure it will end up being a headslapper, I am stymied...
Posts: 10
Joined: Mon May 16, 2011 12:18 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 2 guests