在ubuntu上或docker上安装方法类似,以下是具体步骤。

一般都会先运行pecl

pecl install imagick

但大部分情况下此时会报错:configure: error: not found.

解决:安装imageMagick软件

sudo apt install imagemagick

 

再次运行,pecl install imagick时,还是有错误提示,不过跟之前不同,

报错信息:checking ImageMagick MagickWand API configuration program... configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
ERROR: `/tmp/pear/temp/imagick/configure --with-imagick' failed

解决:需要额外安装以下软件

sudo apt-get install libmagickwand-dev libmagickcore-dev

 

现在运行pecl install imagick,顺利完成。

接下来,如果是docker安装,额外执行以下命令。

docker-php-ext-enable imagick

重启phpdocker即可。