Page MenuHomePhabricator

APC causes Fatal error: require(): Cannot redeclare class profiler in ... AutoLoader.php on line 1145
Open, LowPublicBUG REPORT

Description

XAMPP 1.8.1 portable on Windows 32bit XP SP3, MediaWiki 1.20.2, PHP 5.4.7, MySQL 5.5.27. The wiki is on a USB flash drive (localhost). I've added the .dll from windows.php.net/downloads/pecl/php_apc-3.1.13-5.4-ts-vc9-x86-xp.zip to xampp\php\ext with extension=php_apc.dll in php.ini. Some info for APC is now in phpinfo(). In LocalSettings.php I have $wgCacheDirectory = "$IP/cache"; and $wgMainCacheType = CACHE_ACCEL; when I browse to the wiki's main page I get "Fatal error: require(): Cannot redeclare class profiler in path...\AutoLoader.php on line 1145".


Version: 1.20.x
Severity: major

Details

Reference
bz43563

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:15 AM
bzimport set Reference to bz43563.
bzimport added a subscriber: Unknown Object (MLST).

Hello,

This error occurs when the code loads twice a class Profiler (the same, or two other).

You note your cache configuration in the bug report, is that means if you comment the following line, the error disappears?

  1. $wgMainCacheType = CACHE_ACCEL;
  2. $wgCacheDirectory = "$IP/cache";

Could you also do a search on "class Profiler" and confirm us this exists only one in your MediaWiki directory tree?

[ Removing platform information, not relevant. ]

Hi,

I found it happens only on the USB, if the same folders are on c:\ it's okay. It still happens with both the $wg settings commented out in LocalSettings.php

There is xampp\htdocs\wiki\includes\profiler\Profiler.php and xampp\php\pear\Benchmark\Profiler.php but the one in pear is not mentioned in any .php file, except itself.

In AutoLoader.php:
'Profiler' => 'includes/profiler/Profiler.php',
and in WebStart.php:
require_once( "$IP/includes/profiler/Profiler.php" );

Wondering if the workarounds mentioned in http://stackoverflow.com/questions/4575341/php-with-apc-fatal-errors-cannot-redeclare-class might help, e.g. setting

apc.include_once_override = 0

adrian_gh.popa wrote:

I seem to have hit the same (or a similar) bug when upgrading from 1.17 to 1.20.3.
I get the following error message when accessing "Special Pages" and some of my wiki pages:

PHP Fatal error: require(): Cannot redeclare class mwnamespace in /var/www/html/wiki/includes/AutoLoader.php on line 1145

I did some debugging and the file that needs to be "required" is includes/filebackend/lockmanager/FSLockManager.php, but I can't find a reference to mwnamespace in it.

I am using Centos 6.3 with PHP 5.3.3, Apache 2.2.15 and mysql 5.1.67.

Let me know what the basic steps of isolating this issue are.

Seems a different bug, Adrian. Does it happen if you disable all the extensions?

adrian_gh.popa wrote:

Yes, it happens even if I disable all extensions (and/or I empty the extension folder).
Should I open a new bug report?

Aklapper changed the subtype of this task from "Task" to "Bug Report".Feb 15 2022, 9:39 PM