Beware of Magento Compilation when Installing New Extensions

By December 10, 2012Magento

Beware of Magento Compilation when Installing New Extensions

Ron Peled 5:36 pm

Today I dedicated most of the day to addressing installation complaints with regard to our extensions. These several errors dominated most of these bad installations and all hinted that the Helper class was not registering properly within the Magento Autoload mechanism:

Fatal error: Class 'Activo_Adwordsconversion_Helper_Data' not found in /home//public_html/app/Mage.php on line 516

PHP Fatal error: Call to a member function toOptionArray() on a non-object in /var/www//includes/src/Mage_Adminhtml_Block_System_Config_Form.php on line 421

Notice that both errors occur after we successfully install the extension via the Magento Connect Manager and try to access the System > Configuration area. Both errors are caused by the same symptom: classes are not found properly via the Autoloader.

The Solution

As it turns out all of these sites I was working on today had something in common, they were all hosted on pretty small dedicated environments, probably VMs or semi dedicated shared environments. This means that all of them suffered from poor performance and hence their owners had ventured into the Magento Compilation dark area. I say dark because you really don’t need to use it if you have a nice environment with APC (Alternative PHP Caching) or any other Opt Code Caching mechanism for PHP. In order to resolve it all that needs to be done is recompile!

Recompiling Magento

There is two ways to achieve that. One is via the admin panel > System > Tools > Compilation, hit the ‘Run Compilation Process’ button.

The second way is via the command line, obviously you need to have SSH access with enough permissions to run and execute PHP. From the shell run the following commands:

Ron Peled

About Ron Peled

Builder of things. Builder of teams. Passion: eCommerce & Marketplaces. Magento expert. CTO Mentor.