#254 Cannot redeclare _PEAR_call_destructors() (previously declared in /home/fuccom/public_html/social/extlib/PEAR.php:774) in /opt/cpanel/ea-php73/root/usr/share/pear/PEAR.php on line 834

Open
opened 2 years ago by get52 · 5 comments
get52 commented 2 years ago

I go to install GNU-SOCIAL (MASTER BRANCH)

This error:

Install GNU social Page notice Initializing...

Fatal error: Cannot redeclare _PEAR_call_destructors() (previously declared in /home/fuccom/public_html/social/extlib/PEAR.php:774) in /opt/cpanel/ea-php73/root/usr/share/pear/PEAR.php on line 834

I am on shared hosting cpanel, is there a way to fix

I go to install GNU-SOCIAL (MASTER BRANCH) This error: Install GNU social Page notice Initializing... Fatal error: Cannot redeclare _PEAR_call_destructors() (previously declared in /home/fuccom/public_html/social/extlib/PEAR.php:774) in /opt/cpanel/ea-php73/root/usr/share/pear/PEAR.php on line 834 I am on shared hosting cpanel, is there a way to fix
Diogo Cordeiro commented 2 years ago
Owner

A fix would be to disable php pear extension on cpanel... We have to rename our pear to avoid this conflict.

A fix would be to disable php pear extension on cpanel... We have to rename our pear to avoid this conflict.
tintagel commented 2 years ago

I am experiencing this exact issue. The suggested solution doesn't make sense to me... admittedly I'm new to web server stuff, but as I understand it, PEAR manages extensions, it is not an extension itself, and thus cannot be disabled as one via cPanel. Could someone clarify the above comment, or suggest a new approach?

I do have ssh access to my server as well, if something can be done via that route.

I am experiencing this exact issue. The suggested solution doesn't make sense to me... admittedly I'm new to web server stuff, but as I understand it, PEAR manages extensions, it is not an extension itself, and thus cannot be disabled as one via cPanel. Could someone clarify the above comment, or suggest a new approach? I do have ssh access to my server as well, if something can be done via that route.
yoxem commented 2 years ago

I have also encounter the bug. I tried to comment

require_once INSTALLDIR . '/extlib/' . 'PEAR.php'; near Line 90 in [public_html]/gnu-social/lib/util/framework.php and add the cpanel's PEAR path. the result is:

// This is awful but system's PEAR always gives us issues, we've patched it
require_once '/opt/cpanel/ea-php74/root/usr/share/pear/' . 'PEAR.php';
// require_once INSTALLDIR . '/extlib/' . 'PEAR.php';
 require_once INSTALLDIR . '/extlib/' . 'PEAR/Exception.php';
global $_PEAR;
$_PEAR = new PEAR;
$_PEAR->setErrorHandling(PEAR_ERROR_CALLBACK,
'PEAR_ErrorToPEAR_Exception');

However, there are others needs to be modified.

I have also encounter the bug. I tried to comment `require_once INSTALLDIR . '/extlib/' . 'PEAR.php';` near Line 90 in `[public_html]/gnu-social/lib/util/framework.php` and add the cpanel's PEAR path. the result is: // This is awful but system's PEAR always gives us issues, we've patched it require_once '/opt/cpanel/ea-php74/root/usr/share/pear/' . 'PEAR.php'; // require_once INSTALLDIR . '/extlib/' . 'PEAR.php'; require_once INSTALLDIR . '/extlib/' . 'PEAR/Exception.php'; global $_PEAR; $_PEAR = new PEAR; $_PEAR->setErrorHandling(PEAR_ERROR_CALLBACK, 'PEAR_ErrorToPEAR_Exception'); However, there are others needs to be modified.
tintagel commented 2 years ago

I was able to work around this. I used a cPanel, but I am sure there is a cli equivalent. I went into "Select PHP Version", where php extensions can be activated in cPanel, and from there into "options."

In there, there is a variable called PATH which points to the location of the system's PEAR.php.

I changed it to .:/PATH/TO/INSTALL/DIR/social/extlib

This points the system's php to GNU Social's patched PEAR.php file, so it is a pretty dirty way to fix it. However, it did clear the error and I was able to successfully install.

I was able to work around this. I used a cPanel, but I am sure there is a cli equivalent. I went into "Select PHP Version", where php extensions can be activated in cPanel, and from there into "options." In there, there is a variable called PATH which points to the location of the system's PEAR.php. I changed it to .:/PATH/TO/INSTALL/DIR/social/extlib This points the system's php to GNU Social's patched PEAR.php file, so it is a pretty dirty way to fix it. However, it did clear the error and I was able to successfully install.
senooken commented 1 year ago

I avoided this problem by following fix. FYI.

diff --git a/extlib/PEAR.php b/extlib/PEAR.php
index 220fa7890b..e75fa10fea 100644
--- a/extlib/PEAR.php
+++ b/extlib/PEAR.php
@@ -43,6 +43,8 @@ if (substr(PHP_OS, 0, 3) == 'WIN') {
     define('PEAR_OS',    'Unix'); // blatant assumption
 }
 
+set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path());
+
 $GLOBALS['_PEAR_default_error_mode']     = PEAR_ERROR_RETURN;
 $GLOBALS['_PEAR_default_error_options']  = E_USER_NOTICE;
 $GLOBALS['_PEAR_destructor_object_list'] = array();
I avoided this problem by following fix. FYI. ``` diff --git a/extlib/PEAR.php b/extlib/PEAR.php index 220fa7890b..e75fa10fea 100644 --- a/extlib/PEAR.php +++ b/extlib/PEAR.php @@ -43,6 +43,8 @@ if (substr(PHP_OS, 0, 3) == 'WIN') { define('PEAR_OS', 'Unix'); // blatant assumption } +set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path()); + $GLOBALS['_PEAR_default_error_mode'] = PEAR_ERROR_RETURN; $GLOBALS['_PEAR_default_error_options'] = E_USER_NOTICE; $GLOBALS['_PEAR_destructor_object_list'] = array(); ```
Sign in to join this conversation.
No Milestone
No assignee
5 Participants
Loading...
Cancel
Save
There is no content yet.