62

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.

starball
  • 20,030
  • 7
  • 43
  • 238
DJSunny
  • 1,970
  • 3
  • 19
  • 27

7 Answers7

116

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).

mario
  • 144,265
  • 20
  • 237
  • 291
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

Sumoanand
  • 8,835
  • 2
  • 47
  • 46
  • 8
    Thumbs up for not assuming I already had imagemagick installed. – user2867288 Jul 16 '14 at 03:12
  • you should also mention that a webserver restart seems to be required – jmadsen Mar 22 '15 at 23:48
  • 4
    In my case I had to do `sudo service nginx restart` and `sudo service php5-fpm restart`. – Jimbali Feb 10 '16 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 Oct 25 '16 at 19:51
12

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
bdombro
  • 1,251
  • 11
  • 17
2

For Ubuntu 16 or later:

sudo apt-get install php-imagick

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

Ajeet Shah
  • 18,551
  • 8
  • 57
  • 87
Karl Wolf
  • 188
  • 3
  • 10
1

Install imagemagick with :

sudo apt-get install imagemagick

Install imagemagick PECL extension :

sudo apt-get install php5-imagick

Restart webserver

DependencyHell
  • 1,027
  • 15
  • 22
1

For php8 this is all you need:

apt-get install -y php8.0-imagick
niteris
  • 61
  • 1
  • 3
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
AZinkey
  • 5,209
  • 5
  • 28
  • 46