I struggled to get imagick installed for mamp and dug high and low. I
was left with the impression that so many struggle with opensource and
this type of install that it is almost a right of passage. For my part, I
managed to find two threads that helped me and the steps work. A lot
of people talked about macports and pear installs which are fine(I tried
them), but 1) they sometimes don't get the latest version of what
you need and 2) I can't tell what they're doing and where they're doing it.
It's much easier to me to download the stuff where i want it and be
sure of what i got!
First of all download a tar image of the ImageMagick install from here:
Unpack it and then from terminal issue the following commands in
1. "cd ImageMagick-6.5.7" - go where you placed the folder
If ImageMagick configured and compiled without complaint, you are
ready to install it on your system. Administrator privileges are
required to install. To install, type the following command in terminal:
1. "sudo make install"
To check your ImageMagick installation enter the following command
1. "make check"
Remember all commands are entered into terminal in the directory in
which you unzipped your downloaded ImageMagick tar file. (the latest
version of which at this time of writing is ImageMagick-6.5.7.)
Next we need to install Imagick.so which is what we want for PHP.
First of all we need to get the right file and we can get that from here:
At current writing the latest stable version is imagick-2.3.0.
Unpack the tar file and then enter the commands in quotes in terminal:
1. "cd imagick-2.2.3" - go where you placed the folder
3. "./configure --with-imagick=/opt/local"
5. "make install"
If you look at the bottom of the output, it will tell you where it has
placed the imagick.so module. For me it was placed in:
which is where i had unpacked the downloaded imagick-2.3.0 file.
Then copy it into your MAMP PHP extensions folder.
For me it was:
Then, for PHP to honor the the extension, add the following line to the
extensions section of your php.ini file:
You should now have a working imagick extension with all of the
resources for php found here:
I will not claim credit for anyone for whom this works, that goes to:
Imagemagick who posted instructions here:
and Wallance who posted his experience here:
I really hope this helps others because developing this stuff is
frustrating enough without spending hours or even days just trying to set
up the development environment so you can use the tools.
This » PECL extension is not bundled with PHP.
Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/imagick.
Nota: The official name of this extension is imagick.
A DLL for this PECL extension is currently unavailable. See also the building on Windows section.
If you tried to install it on Linux and got this message
pecl install imagick
/var/tmp/imagick/php_imagick.h:49:31: fatal error: wand/MagickWand.h: No such file or directory
make: *** [imagick_class.lo] Error 1
ERROR: `make' failed
this is what solves it:
yum install ImageMagick-devel
For PHP 5.3 I have read that these versions should work:
Installing Imagick on Windows isn't too hard. I followed the guide at http://valokuva.org/?page_id=50 and managed to install it without too much sweat.
1. Visit http://imagemagick.org/script/binary-releases.php#windows and download "ImageMagick-6.5.4-6-Q16-windows-dll.exe"
2. Pick a version at http://valokuva.org/outside-blog-content/imagick-windows-builds/ The directories are in YYMMDD format. The latest version that worked for me was 2008-Jul-09 so download 080709/php_imagick_dyn-Q16.dll respectively.
3. Rename php_imagick_dyn-Q16.dll to "php_imagick.dll" and move it to php/ext
4. open php.ini, and make sure
appears in the file and uncommented then resave.
Note: phpinfo() will tell you the location of the loaded php.ini file.
5. Re-start your webserver.
That's it, a simple test will tell you if your installation was successful.
$im = new Imagick();
$im->newPseudoImage(100, 100, "magick:rose");
PECL install imagick contantly fails due to the server is behind some firewall, so one may try 'phpize' way to install.
However, someone like me who doesn't want to use default options may experience thru failure situation. And if you google thru the cloud, you may find many people tell you to rpm imagick-devel with yum or apt. That does solve the problem.
However, In my case, my server already has php 5.3.1 installed under /usr/lcal/php & the linux doesn't have yum or apt service. Furthermore, I just installed imagemagick yesterday (Also quite a battle =.=) under /usr/local/imk
(note: You may see that I don't like default options, I like to install each package under different dir under /usr/local).
Today, I want to install imagick, so this is what I do:
1> add /usr/local/php/bin & /usr/local/imk/bin to path.
2> download imagick source of intended version (I use 3.0.b1).
3> enter that dir & issue 'phpize'.
(note:I got a habit to issue './configure --help > oo' & 'view oo' to see all the options first before installation)
4> 'vi configure' & find LIBS, then add '-l/usr/local/imk/lib' after it.
5> issue './configure --prefix=/usr/local/ik4php' --with-imagick='/usr/local/imk'.
(note: with-imagick points out where you install the imagicmagick package before, this name 'imagick' is not appropriate since it incurs ambiguity with imagick for php =.=)
6> after it's done, issue 'make'.
7> after make is done, issue 'make install'.
(note:the last two output lines will tell you where to find the generated shared object library file: imagick.so)
8> go to that dir & copy imagick.so to the extension dir defined in php.ini.
(note: in my case it's /usr/local/php/ext)
9> edit php.ini to add 'extension=imagick.so' line.
10> stop & start apache or just restart apache.
(note: if you have tomcat + apache + jk module installation style as mine, shutdown tomcat, stop apache, then startup tomcat first, then start apache)
If you have similar server environment & situation as mine, hope this article helps you.
Scott Chu @ Taiwan
To install on debian simply try:
apt-get install php5-imagick
sudo apt-get install php5-imagick
if you get the following error on windows (vista):
'The application has failed to start because its side-by-side
configuration is incorrect. Please see the application event log
for more detail.'
Visual C++ 2008 Redistributable Package (x86)
for more info (scroll to the end of the page)
Installation of Imagick on Windows:
Here an important hint for all who want to use Imagick:
First of all: Forget this PECL.
It is for Linux only.
In the old discussion boards I read that some years ago there was a DLL for PHP available on the FTP server of imagemagick.org. Once upon a time there has also been a CHM installation help file on FTP which also has been removed. The only thing you find today on the FTP server is a ridiculous text file:
This file contains 3 links:
2 links of them are dead meanwhile.
The only working one is this:
a page of a chinese guy who offers a MagickWand.dll for PHP of 4 MB size (Q8, static compiled)
But he discontinoued support since 2007.
There is no installation manual available.
He only writes:
"Please ref watson's post about how to install on Windows:
This page which uses stupid style sheet settings like "font-size:11%" which make parts of the text unreadable also was no help.
At the end all manuals say the same:
Copy the DLL into the "ext" folder and add the entry to the php.ini:
restart the Apache and you are done.
But this is not true: it simply does NOT work on Xampp.
In a DOS box entering
PHP.exe -i > Info.txt
prints all installed modules.
You also find:
MagickWand Backend Library => ImageMagick
MagickWand Extension Version => 1.0.5
ImageMagick support => enabled
ImageMagick version => ImageMagick 6.3.5 09/21/07 Q8 www.imagemagick.org
ImageMagick QuantumRange (MaxRGB) => 255
MagickWand supported image formats => A, ART, AVI, AVS, B, BIE, BMP, BMP2, BMP3, etc.."
But after executing phpinfo() MagickWand does NOT appear under the installed extensions. Strange!!
And the Wand commands do NOT function like:
$resource = NewMagickWand();
I also found a php_imagick.dll of 65 kB size in the internet which also does not work. It does not even appear in
There is no error in the Apache logfile!
I read all I could find in the internet and wasted 2 entire days, without success, now I'm sick of Imagick and I absolutely cannot understand why the guys of imagemagick.org don't offer a ready compiled dll with an installation manual anymore?
In general the Imagick page seems not very trustworthy:
On the download page they do never explain what is the difference between the several versions. What doess static mean?
They never explain. (Static means that the convert.exe does not depend on so many dlls. It only requires one external DLL, for that it has a size of 5 MB instead of 200 kb)
And the explanation about the difference between Q8 and Q16 version is wrong: Q8 does NOT mean 8 Bits per pixel as the download page says. It means 8 Bit per color = 24 Bit per Pixel)
And I found an ugly misdesign:
If you install the Q8 version on your local PC and want to copy the files from your harddisk to the server, then convert.exe will crash!
Convert.exe depends on a Registry Entry. And if this is missing (on a server where you have not full access) it will crash. The strangest thing is that this registry key can contain any nonsense, it only must exist! How stupid!
So if you want to execute as an alternative the commandline tools like convert.exe from your PHP code you must add this Registry entries to the server:
The value can be anything.
But with the commandline tools you cannot obtain the width and height of an image in your PHP code. This is not possible.
I could not install via PECL or compiling from source because of an error from line 3339 of the configure file generated by phpize so I looked at the configure file at line 3339 and it was just a check for the PHP version using the php-config command with the --vernum switch which was not supported by my PHP version so I commented out that check from the configure file and then it would configure, compile, and install.
After installation, it put the shared object file in my php extension modules directory so I added an entry to my /etc/php.d directory to load the extension file and restarted apache and the imagick section is present in my info.php output.