Home arrow Blog arrow Joomla extension installer memory failures

Joomla extension installer memory failures

The Joomla! installer for adding extensions can take excessive amounts of memory. So much so that your PHP memory may be exceeded, causing the install to fail. A significant part of the problem is a coding error that can be easily fixed.

If you look in the directory ../libraries/joomla/filesystem/ you can find a file called archive.php. Around line 132, the code goes like this:

function &getAdapter($type)
{
    static $adapters;

    if (!isset($adapters)) {
        $adapters = array();
    }

The statement that says $adapters should be static is the cause of much trouble. For a large extension, a great deal of data is needlessly accumulated in memory. This can amount to many megabytes. This can be avoided by commenting out that line, so the code then reads:

function &getAdapter($type)
{
    // static $adapters;

    if (!isset($adapters)) {
        $adapters = array();
    }

The Joomla! extension installer will then use a lot less memory for large extensions.

#128002 • 08/30/2009 8:34am by Martin Brampton • Vote: Up votes (290) Down votes (187)