Getting Imagick installed correctly with PHP

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
sp0n9e

Getting Imagick installed correctly with PHP

Post by sp0n9e »

There are several ways to get Imagick compiled and/or installed with php.

First of all, you need to know Imagick is a PECL extension which means it will not be available at many shared hosts. You will usually need access to compile php yourself.

The pear method (shared)

If you have pear installed and a copy of phpize (if you didn't compile php, it comes in the package php-dev or php-devel or php5-dev or php5-devel), this is by far the easiest method.

Code: Select all

pecl install imagick-beta
Compiling it by hand (shared)

This isn't really compiling by hand, but this is a bit less automated than that above. It also works for the latest cvs copy of Imagick. Download the tar from pecl.php.net and extract it. You can then run these commands to compile and install Imagick.

Code: Select all

phpize && ./configure && make install
For both (shared) methods

Please set up extension_dir to the location where imagick.so was generated. Then add `extension=imagick.so` to the php.ini file so that the shared extension is loaded.

Compiling Imagick statically

TODO

* Windows users may download Imagick from http://pecl4win.php.net/ext.php/php_imagick.dll (does not link straight to the .dll). As of the time of this writing, wheels are moving to get a recent version of Imagick up there (versions <=1.0 are very old and come from a previous attempt at an extension, 2.0 is the OO extension and is NOT FOR PHP4).
Mitron

Re: Getting Imagick installed correctly with PHP

Post by Mitron »

sp0n9e wrote:TODO

* Windows users may download Imagick from http://pecl4win.php.net/ext.php/php_imagick.dll (does not link straight to the .dll). As of the time of this writing, wheels are moving to get a recent version of Imagick up there (versions <=1.0 are very old and come from a previous attempt at an extension, 2.0 is the OO extension and is NOT FOR PHP4).
As a bit of an update I ran into an issue installing Imagick on Windows and thought I'd add a note here for those attempting to get this up and running. PHP 5.2.5 release no longer has the php_imagick.dll file included in the pecl extensions so Windows users need to grab a snapshot of the pecl extensions or download it from the link above.

The php_imagick.dll in the link above is currently compiled against ImageMagick 6.3.3, so if you plan on running the latest extension from there you will need to install ImageMagick 6.3.3.

Also, Mikko has an updated extension on his site that works with ImageMagick 6.3.7. Just be sure your php_imagick.dll file matches the ImageMagick version or neither of these extensions will work. I tried numerous combinations before I realized what was going on.

I'm assuming that if you have Visual C++ you can compile the source to whatever version of ImageMagick you want as long as it's above 6.x.x.

Hope this helps.
adamoli

Re: Getting Imagick installed correctly with PHP

Post by adamoli »

You may have solved my problem. Where is Mikko's site? I've already installed the later version of ImageMagick, so I'd like to go with the later extension as well. Thanks.

Tony
Mitron

Re: Getting Imagick installed correctly with PHP

Post by Mitron »

Mikko's site or in particular, the page that has the .dll is here: http://valokuva.org/?page_id=50

Just be sure you use the correct ImageMagick 6.3.7 as indicated on that page or you may have issues.
mkoppanen
Posts: 309
Joined: 2007-06-09T07:06:32-07:00

Re: Getting Imagick installed correctly with PHP

Post by mkoppanen »

I will update the DLLs on my site to work with ImageMagick 6.3.9. I'm in the middle of a reinstall, so shouldn't take that long.
Mikko Koppanen
My blog: http://valokuva.org
Post Reply