61

I'm attempting to install ImagicK as its required for a Yii Extension I want to use for my project.

I've checked around and followed a few different suggestions but nothing that has worked so far, ultimately the framework extension is still throwing me an error (Must have ImagicK installed).

I've tried things like:

sudo apt-get update
sudo apt-get install imagick-php5 .. etc

as well as the PECL install which ends up throwing me the following error:

Checking ImageMagick MagickWand API configuration program... configure: error: 
not found. Please provide a path to MagickWand-config or Wand-config program. 

Any help as to how to get ImagicK installed and integrated with PHP on Ubuntu 11.10 would be great.

0

7 Answers 7

115

The package has a different name in Ubuntu.

 sudo apt-get install php5-imagick

The error with building via PECL means you must install libmagickwand-dev, libmagickcore3, libmagickwand3 probably (there are alternatives: graphicsmagick-imagemagick-compat, see Synaptic).

4
  • Not usally. You may wish to check /etc/php5/conf.d/. But installing such a package ought to add an uncommented directive there.
    – mario
    Commented Jan 14, 2013 at 22:57
  • Sorry, I was actually doing something else wrong, but thanks for the info!
    – SSH This
    Commented Jan 14, 2013 at 23:35
  • 2
    sudo apt-get install php5.6-imagick now for Ubuntu 16.04 and upper
    – Papotitu
    Commented Jul 13, 2017 at 16:11
  • 3
    sudo apt-get install imagemagick php-imagick for Ubuntu 16.04
    – Matiss
    Commented Aug 24, 2017 at 11:56
60

Installation steps for Ubuntu 12.04:

  1. Install imagemagick

    sudo apt-get install imagemagick

  2. Install imagemagick PECL extension

    sudo apt-get install php5-imagick

  3. Restart webserver

4
  • 8
    Thumbs up for not assuming I already had imagemagick installed. Commented Jul 16, 2014 at 3:12
  • you should also mention that a webserver restart seems to be required
    – jmadsen
    Commented Mar 22, 2015 at 23:48
  • 4
    In my case I had to do sudo service nginx restart and sudo service php5-fpm restart.
    – Jimbali
    Commented Feb 10, 2016 at 13:47
  • If you are using php 5.6, then you need to do sudo apt-get install php5.6-imagick. And for nginx and php-fpm: sudo service nginx restart and sudo service php5.6-fpm restart
    – Nico
    Commented Oct 25, 2016 at 19:51
14

Installation steps for Ubuntu < 16.04:

sudo apt-get install imagemagick php5-imagick; sudo service apache2 restart

Installation steps for Ubuntu > 16.04:

sudo apt-get install imagemagick php-imagick; sudo service apache2 restart
2
  • You wrote the same thing twice.
    – johnRivs
    Commented Oct 13, 2016 at 10:59
  • 1
    Actually, they are different. Notice that one has php5-imagick and the other php-imagick
    – bdombro
    Commented May 19, 2020 at 11:27
3

For Ubuntu 16 or later:

sudo apt-get install php-imagick

(note the use of php- instead of php5-)

0
2

For php8 this is all you need:

apt-get install -y php8.0-imagick
1

Install imagemagick with :

sudo apt-get install imagemagick

Install imagemagick PECL extension :

sudo apt-get install php5-imagick

Restart webserver

0

With Ubuntu 16.04 (Xenial) with PHP 5.6 not 7. PHP 7 was disabled.

  1. sudo apt-get update
  2. sudo apt-get install imagemagick php5.6-imagick

Not the answer you're looking for? Browse other questions tagged or ask your own question.