0

I am trying to change configuration from backend & once i click on "Save config" it displaying below error :

Fatal error: Class 'Imagick' not found in app/code/local/Aitoc/Aitcg/Model/System/Config/Backend/EnableSvgToPdf.php on line 16 [ $imagick = new Imagick(); ]

<?php

class Aitoc_Aitcg_Model_System_Config_Backend_EnableSvgToPdf extends Mage_Core_Model_Config_Data
{
    public function _beforeSave() {
        parent::_beforeSave();
        if ($this->getValue() == 1)
        {
            exec("convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
            //echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.

            if (!($rcode === 0))
                throw Mage::exception('Mage_Core', Mage::helper('aitcg')->__('Requires ImageMagick to be installed at your host and allowed php exec command;  check http://www.imagemagick.org/script/formats.php for possible format conversions'));

            try{
            $imagick = new Imagick();
            }
            catch (Exception $e)
            {
                throw Mage::exception('Mage_Core', Mage::helper('aitcg')->__('Requires ImageMagick to be installed at your host and allowed php exec command;  check http://www.imagemagick.org/script/formats.php for possible format conversions'));
            }
            // return $this->_getPromoBlock();

        }

    }

}

system.log :

Warning: include(Imagick.php): failed to open stream: No such file or directory  in lib/Varien/Autoload.php on line 94
Warning: include(): Failed opening 'Imagick.php' for inclusion (include_path='app/code/local:/app/code/community://app/code/core:/lib:.:/usr/share/php:/usr/share/pear')  in /lib/Varien/Autoload.php on line 94

i followed link & i did changes as mentioned in comments .

  1. added this code : if ($class === 'File') { mageDebugBacktrace(); } in /lib/Varien/Autoload.php on line 94 as here : http://pastebin.com/yiZ0cjVy

also followed answer & added code : <cache><backend><![CDATA[File]]></backend</cache> in app/etc/local.xml as below . but still i am facing same issue.

<config>
    <global>
        <install>
            <date><![CDATA[Thu, 31 Mar 2016 10:28:26 +0000]]></date>
        </install>
        <crypt>
            <key><![CDATA[97855aaa840e2283935951360d376dd3]]></key>
        </crypt>
        <disable_local_modules>false</disable_local_modules>
        <resources>
            <db>
                <table_prefix><![CDATA[]]></table_prefix>
            </db>
            <default_setup>
                <connection>
                   <host><![CDATA[localhost]]></host> 

                    <username><![CDATA[grtrtrtt]]></username>
                    <password><![CDATA[trtrtrtrt]]></password>
                    <dbname><![CDATA[trtrtrtrtrtrtrt]]></dbname>
                    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                    <model><![CDATA[mysql4]]></model>
                    <type><![CDATA[pdo_mysql]]></type>
                    <pdoType><![CDATA[]]></pdoType>
                    <active>1</active>
                </connection>
            </default_setup>
        </resources>
        <session_save><![CDATA[files]]></session_save>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[admin]]></frontName>
                </args>

            </adminhtml>
        </routers>      
    </admin>
    <cache>
    <backend><![CDATA[File]]></backend>    
    </cache>
</config>

or did i wrote code in wrong place in any of above files - Autoload.php / local.xml ?

5
  • It looks like you may not have Imagick installed or enabled on your system. Do you have SSH access to your server? If so, can you run php -i | grep -i Imagick and update your question with the output? Feb 21, 2017 at 9:39
  • @DannyNimmo i executed this command successfully : sudo apt-get remove --purge php5-imagick && sudo apt-get install php5-imagick in server, i guesss i did some other wrong in following this link , can you please check code i posted in question..... Feb 21, 2017 at 9:44
  • @DannyNimmo okay , i cross checked it once again by running command : convert -version and it gave me output as : prnt.sc/ebhclv Feb 21, 2017 at 10:00
  • Please run the previous command I mentioned to confirm the extension is enabled in PHP. Feb 21, 2017 at 10:12
  • @DannyNimmo please check : prntscr.com/ebhhyn Feb 21, 2017 at 10:13

1 Answer 1

1

It seems imagick is not installed on your server.

Install it on server run following command on server

  • pecl install imagick
  • sudo apt-get install php5-imagick && sudo php5enmod imagick

For more information http://php.net/manual/de/book.imagick.php

2
  • okay , i cross checked it once again by running command : convert -version and it gave me output as : prnt.sc/ebhclv Feb 21, 2017 at 10:00
  • i guesss i did some other wrong in following this link , can you please check code i posted in question.... : Autoload.php & local.xml Feb 21, 2017 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.