You are hereHome / Development / How to install imagick and gmagick on Ubuntu

How to install imagick and gmagick on Ubuntu


By Gerd Riesselmann - Posted on 18 September 2010

I had to struggle a while installing the PECL extensions imagick and gmagick on my Ubuntu Hardy machine, here's a simple how-to.

imagick

Ubuntu Hardy comes with a package for imagick. You can install it by calling sudo apt-get install php5-imagick. However, this installs vesion 2.0.0, which is way too old, and misses some important (though still undocumented) features. If you want to upgrade to a more recent version (3.0.0 or higher), you must install it manually using the PECL installer.

  1. sudo apt-get install imagemagick libmagick9-dev
  2. sudo pecl install imagick
  3. Confirm all questions by hitting return
  4. Create file /etc/php/conf.d/imagick.ini and add a line "extension=imagick.so"
  5. Reload Apache: sudo /etc/init.d/apache2 reload

gmagick

The gmagick extension is not bundled with Ubuntu, so it must be installed manually anyway.

  1. sudo apt-get install graphicsmagick libgraphicsmagick1-dev
  2. sudo pecl install gmagick
  3. Confirm all questions by hitting return
  4. Create file /etc/php/conf.d/gmagick.ini and add a line "extension=gmagick.so"
  5. Reload Apache: sudo /etc/init.d/apache2 reload

I noticed that having both extensions enabled causes phpinfo to suddenly break. So this may be a problem.