CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • PEAR conflict with Drupal
Pages: [1]

Author Topic: PEAR conflict with Drupal  (Read 1496 times)

Hans.S

  • I post occasionally
  • **
  • Posts: 51
  • Karma: 5
PEAR conflict with Drupal
May 27, 2009, 08:36:13 am
Fatal error: Cannot redeclare _pear_call_destructors() (previously declared in /var/www/vhosts/"site url"/httpdocs/cms/sites/all/modules/flashvideo/drivers/Storage3/PEAR.php:759) in /var/www/vhosts/"site url"/httpdocs/cms/sites/all/modules/civicrm/packages/PEAR.php on line 806

We are experiencing a conflict between CivicRM and the Drupal FlashVideo AmazonS3 module. WE would like to use both modules since they are essential to the functionality of the site. However it may be possible to turn off the functions in CivicRm that use PEAR.php.

Which functionality in CiviRM uses pear.php and for what purpose? Can they be turned off as a workaround to prevent this error from happening?


Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: PEAR conflict with Drupal
May 27, 2009, 10:10:59 am

your best bet would be to debug either module and see what you need to change to ensure that PEAR.php is included only once. I suspect a couple of hacks to CiviCRM and/or FlashVideo might be needed. if on CiviCRM end, please let us know what changes you did and we'll attempt to incorporate in a future release

CiviCRM uses PEAR across multiple files, so turning it off is not an option (IMO).

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: PEAR conflict with Drupal
May 29, 2009, 09:48:55 am
i reproduced this error and experimented with a few different hacks to fix this. The easiest hack with minimal changes is to patch  packages/PEAR.php in civicrm root (patch attached at end)

I also suggest a similar change in Storage3.php

I'm not sure if we can do anything better than these hacks since PEAR.php is pretty invasive thru most of the pear packages. If this becomes an issue for a lot more folks, we'll consider changing svn. Its kinda a crappy hack to get around PHP limitations / no standard library / hacks done by various open source packages (including civicrm :(

lobo


Code: [Select]
svn diff PEAR.php
Index: PEAR.php
===================================================================
--- PEAR.php    (revision 21531)
+++ PEAR.php    (working copy)
@@ -1,4 +1,7 @@
 <?php
+
+if ( ! 
class_exists( 'PEAR' ) ) {
+

@@ -
1108,6 +1111,8 @@
     
// }}}
 
}
 
+}
+
« Last Edit: May 29, 2009, 09:52:00 am by Donald Lobo »
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Hans.S

  • I post occasionally
  • **
  • Posts: 51
  • Karma: 5
Re: PEAR conflict with Drupal
May 31, 2009, 11:39:27 am
I googled this and fount the following solution:

I beleive this is a conditional statement that prevents the fatal error for the functions.

if (!function_exists('_PEAR_call_destructors')) {}

Is this better or more problematic than using it on the class:

if ( ! class_exists( 'PEAR' ) ) {}

(I am not really  programmer I understand a little bit.)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • PEAR conflict with Drupal

This forum was archived on 2017-11-26.