5

I'm running OSX Leopard with MAMP (a sandbox consisting of Apache/MySQL/PHP). I installed ImageMagick using MacPorts by following this tutorial: http://www.brybot.ca/archives/getting-imagemagick-and-more-to-work-with-mamp-on-os-x/

Then I added extension=imagick.so to the php.ini But PHP won't recognize it. It keeps telling me:

Fatal error: Class 'imagick' not found

Any idea how to fix this?

jdlx
  • 125
  • 8
lo_fye
  • 6,790
  • 4
  • 33
  • 49

4 Answers4

8

This question is old but I had the problem today and it seems to be easier than before.
This solution uses OSX 10.13 with MAMP 4 and Homebrew.

  • Install Image Magick by running brew install imagemagick.
  • Open the file /Applications/MAMP/bin/php/[yourPhpVersionThere]/conf/php.ini.
  • Search the line ;extension=imagick.so, and delete the ';' at the beginning of the line.
  • Restart MAMP

You are done.

Anthony
  • 2,014
  • 2
  • 19
  • 29
  • This doesn't seem to work for me, when I run a simple code line like `$im = new Imagick("test.png");`. I receive a `localhost is currently unable to handle this request.` error. – Otto Nov 10 '18 at 13:13
  • I no longer use OSX, but this solution worked easily for me. Did you follow the steps? – Anthony Nov 10 '18 at 15:22
  • 1
    This trick worked for me. However, for some reason the `imagick.so` extension isn't shipped with the PHP 8.0.0 release and will only work with the older 7.4.12 version on MAMP 6. Just something to be aware of. – Husky Jun 03 '21 at 15:29
2

Watch out: Imagemagick and Imagick are not the same! While Imagemagick is a CLI suite/lib to manipulate images, Imagick is a PHP Wrapper class to use Imagemagick in PHP natively (read as without using exec() or alike..).

A imho good guide on installing both Imagemagick and Imagick @ OSX is this one.

UPDATED

Give this guide a try: Imagick for MAMP-Pro installation guide (which is my slightly more detailed fork of: Mamp-Imagick-Manual )

Matt Sephton
  • 3,711
  • 4
  • 35
  • 46
jdlx
  • 125
  • 8
1

You may need to follow the macports installation instructions for adding /opt/local and /opt/local/bin to your PATH variable.

If you've already done that, then find out where MacPorts has put the imagemagic library and copy it to your PHP installation's extension dir (or create a link from your extension dir to the file).

By default, MacPorts will compile and install things to work with other MacPorts libraries, so when compiling to work with non-MacPorts libraries, you may need to move files around and tweak paths a bit.

Andru
  • 7,011
  • 3
  • 21
  • 25
0

(Is case php case-sensitive? If I google around a bit, it's Imagick with a capital i.) Is it enough to download image-magick? If I read this correctly, you need a php wrapper for image-magick also.

Stijn Sanders
  • 35,982
  • 11
  • 45
  • 67