zeros-and-ones zeros-and-ones - 1 year ago 124
PHP Question

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:

Restarted apache

sudo apachectl restart

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

Answer Source

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 :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download