Yireo - Extensions, tutorials and blog for Magento and Joomla!

Blog Tags

MageBridge Standard

Magento 1.4 Fatal Error on _pear_call_destructors()

Monday, 15 February 2010

When upgrade to Magento 1.4 you might get caught with a PHP Fatal Error, especially when you're trying to access the Magento Downloader:

Fatal error: Cannot redeclare _pear_call_destructors()
(previously declared in .../pearlib/php/PEAR.php:775) in /usr/share/php/PEAR.php

Forget about the system PEAR

The problem here is that the Magento Downloader uses some extra PEAR libraries, which might also be included on the system-level (for instance in /usr/share/php). But because PHP only allows PHP-functions to be declared once, including both the Magento PEAR library as well as the systems PEAR library causes a PHP Fatal Error.

Modifying php.ini

To fix this, the best thing to do is to make sure Magento uses it's PEAR library and not the system PEAR-libraries. You'll need to change the PHP-setting include_path. This might be set to something like this (including the system PEAR-path):

include_path = ".:/usr/share/php"

Change it to the following (so only the Magento libraries are included):

include_path = "."

Where to modify?

Where you can edit this PHP-setting depends on your hosting environment. Some hosters create a php.ini file per customer, so you should be able to edit this through FTP. Other others allow to alter the include_path through their control panel.

You might also want to try to change the setting through a htaccess file. For the Magento Downloader you'll need to modify the file {MAGENTO}/downloader/.htaccess and add the line:

php_value include_path "."

Hope this helps.

About Yireo

Yireo tries to help webdevelopers build successful Joomla! and Magento sites.

More about Yireo