Installing ImageMagick for PHP on Ubuntu

iMagick is a wrapper class, wrapping the most common web image manipulation actions in easy to use functions, but allowing full access to iMagick’s power by issuing system calls to it’s command-line programs. There is no proper documentation for Installing ImageMagick for PHP on Ubuntu or any other LINUX based systems. Here is some simple steps for enabling ImageMagick library to work with PHP. Also there is no need to worry for MagickWand. iMagick will do everything for you.

First of all remove everything you have tried to make it work. Uninstall iMagick with the following command:

sudo apt-get remove imagemagick

Remove ImageMagick and all its dependencies with the following command:

sudo apt-get remove –auto-remove imagemagick

Purge the config file of ImageMagick with the following command:

sudo apt-get purge imagemagick

Or similarly, like this:

sudo apt-get purge –auto-remove imagemagick

Well, all your previous installation files are just gone. Now Install it purely and perfectly without any conflict or file modification. Enter the following two commands:

sudo apt-get install imagemagick
sudo apt-get install php5-imagick

That was way too easy – thanks interwebs! Remember to restart/reload your webserver..

sudo service apache2 graceful

That’s all. Check your php.ini or test with any simple script. For simple scripts to test iMagick you can refer to this post.