Search code examples
phplaravelimagemagickhomebrewlaravel-valet

Laravel 5.2, class 'Imagick' not found


I am using Laravel Valet. I have installed image magick and imagick via brew using the following commands

brew install imagemagick

and

brew install homebrew/php/php70-imagick

Inside my /project directory.

When I run brew search I get a little tick next to each, showing that they have installed.

However, when I try to use it in my project I get the dreaded "class Imagick not found" error. Not too sure what I did wrong here.


Solution

  • Append the extension to your php.ini:

    echo "extension=imagick.so" >> /etc/php5/apache2/php.ini
    

    Restart Apache

    service apache2 restart
    

    Or

    Can you try editing php.ini located in

    cd /etc/php5/apache2/php.ini
    

    if your linux is ubuntu ?

    cat php.ini | grep extension=imagick.so
    

    if there is the results of search, then you might get this

    ;extension=imagick.so
    You remove this semicolon ; and if not any results,
    echo "extension=imagick.so" >> /etc/php5/apache2/php.ini
    

    And finally

    sudo /etc/init.d/apahce2 restart