Search code examples
phpmacosgraphicsmagick

PHP and Graphics Magick on MacOSX after brew installing


I'm trying to switch to GraphicsMagick from Imagick, because I read it was better for performance if you don't need a lot of the fancy options that come with IMagick. I was able to install it via:

brew install graphicsmagick

After it was installed I'm trying to use it:

use GMagick;

$image = new GMagick($request->file('banner_image')->path());
$image->resizeimage(600,600, Gmagick::FILTER_LANCZOS,1)

Seeing error:

Class 'GMagick' not found

Added the extension to php.ini with this:

extension=gmagick.so

Restarted apache

sudo apachectl restart

Nothing works....can anyone offer any insight?


Solution

  • I did a quick search and found that you can brew php56-gmagick ... probably the one you wanted. Try to uninstall your graphicsmagick and brew the one i suggest here. I just installed for php55 without a glitch. If you run php -m you should see the gmagick extension loaded successfully (did for me).

    ps. Dont forget to restart your apache to get access from http sessions running php scripts.

    pps. If you run php-fpm, restart that too :)