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
The Public Knowledge Project Support Forum is moving to

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 10
Joined: Mon May 16, 2011 12:18 pm

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/, referer:
[Thu Jan 30 14:11:01 2014] [error] [client] PHP Fatal error: Cannot redeclare class UsageStatsReportPlugin in /volumes/1TB/htdocs/ojs2/plugins/generic/usageStats/ on line 21, referer:

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 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 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: 189
Joined: Tue Jun 25, 2013 2:22 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: 10
Joined: Mon May 16, 2011 12:18 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...

Return to “OJS Technical Support”

Who is online

Users browsing this forum: No registered users and 1 guest