Page MenuHomePhabricator

Cannot redeclare class pear in PEAR.php
Closed, ResolvedPublic

Description

Author: jonathan.w.smith

Description:
MediaWiki error has occured when trying to upgrade from Beta to 1.35, 1.36 and
now 1.37. Same error message each time:

Fatal error: Cannot redeclare class pear in
/home/jcwinni/public_html/mwp3/PHPTAL-NP-0.7.0/libs/PEAR.php on line 72


Version: 1.3.x
Severity: major
URL: http://jcwinnie.biz/mwp/

Details

Reference
bz766

Revisions and Commits

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 7:00 PM
bzimport set Reference to bz766.
bzimport added a subscriber: Unknown Object (MLST).

ovvldc wrote:

After cracking another issue, I got the same thing on upgrading from 1.3.2 to 1.3.7.

Fatal error: Cannot redeclare class pear in
<removed my server path>/Wiki/PHPTAL-NP-0.7.0/libs/PEAR.php on line 72

All of my PHP info and config are already in bug 618.

However, this doesn't seem to be an installation issue, since I get the bug
after I run the install script and move localsetting.php and just try to open
the main page.

ovvldc wrote:

Fixing summary to reflect actual problem.
CC'ing myself

Can you list the ini_set statements in your LocalSettings.php? Confirm they are the correct paths, that
you're not mixing versions.

ovvldc wrote:

Actually, I did a clean install of 1.3.7, using the web installer, intending to
pick up the database and copy back the image directory from my 1.3.2 version.
The only thing I did to localsettings.php after that was to enable uploads (i.e.
uncomment the relevant disable line).

Unfortunately I trashed the 1.3.7 files I had on my system (hoping you might fix
this by 1.3.8). If the info above is not sufficient I can try again from
scratch. Let me know if that is the case.

jonathan.w.smith wrote:

I am pleased to report success when upgrading from 1.3-Beta to 1.3.8.

I previously had reported an error occurring when I tried to upgrade from the
Beta version to 1.35, then 1.36 and then 1.37.

From my perspective, the bug is fixed. Thanks.

ovvldc wrote:

In my case, the bug remained. However, I was playing around and compared the old
and working localsettings.php with the new one that wasn't. I transferred some
things after I read PEAR is needed for the skin.

There were five differences between the localsettings:

I have imagemagick now.
$wgUseImageResize = true;

Uploads were disabled in the new one.
$wgDisableUploads = false;

I use fixed messages and require a login for editing so these two were extra.
$wgUseDatabaseMessages = false;
$wgWhitelistEdit = true;

The proxy key was different.
$wgProxyKey = "<long hash>";

I left the resize and copied the other ones in. And it works now. Since
whitelist editing and uploads are associated with editing and resize isn't it,
the bug must be in the DatabaseMessages or ProxyKey. I tried removing the
DatabaseMessages and my wiki still works. I have no idea what the ProxyKey does
(please send me a message and let me know - couldn't find it in the manual).

So now there seems to be a workaround, but the problem is sort of still there..
Reopening with reduced severity due to the workaround.

I ran into a similar problem when upgrading from 1.3.5 to 1.3.8, the error is a
bit different:

PHP Fatal error: Cannot redeclare _pear_call_destructors() in
/var/www/htdocs/mediawiki-1.3.5/PHPTAL-NP-0.7.0/libs/PEAR.php

(note the reference to the old path even if you fixed all of them in your config)

I needed to remove all file like /tmp/tpl_0_7_0*. Those file contained a ref to
the old path ala
<?php require_once "/var/www/htdocs/mediawiki-1.3.5/PHPTAL-NP-0.7.0/libs/GetText
.php";

Please test with 1.4beta, see if the problem is resolved.

ovvldc wrote:

I tested with 1.4beta1 and all was well.

Thanks for the feedback! Resolving as fixed.

Diffusion added a commit: Unknown Object (Diffusion Commit).Mar 4 2015, 8:23 AM