Search code examples
phpapacheclassnotfoundexceptionimagickzend-framework2

Imagick class not found only on a zf2 project


I have a gentoo linux amd64 server that runs apache 2.2.22 with PHP 5.4.6.

I have a Zend Framework 2 project that works with zf v2.0 b7.

I installed the Imagick pecl extension using emerge and after restarting apache and viewing phpinfo's output I can clearly see that Imagick extension is installed properly.

I added to one of the actions in my Zend Framework project the following line:

$im = new Imagick();

when I run the action on my browser I get the following error:

Class 'DrinkManagement\Controller\Imagick' not found

now.. if I create a simple php file with this line of code (new imagick) and I run it on console (php-cli) and on my browser it works properly which means that zend framework's file include methods somehow break Imagick.

any ideas ?

any information would be greatly appreciated

thanks

kfir!


Solution

  • ok i found as solution for the problem.

    Using Imagick in Symfony2?

    (answered copied from the url above)

    When you instantiate the Imagick class, use a full quallified class-name:

    new \Imagick;
    

    This will make PHP not look for the class Imagick within the current namespace.