Debian/Ubuntu

Установка ImageMagick

Updating information about available packages:

apt update

We perform the installation:

apt install imagemagick

Checking the installed version:

convert -version

In response, you will receive a withdrawal:

Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib

If the last command returned information about the installed version, then everything is installed correctly.

Installing php-imagick

Executing the command:

apt install php-imagick

Checking the installed extension:

root@user:~# php -m |grep imagick
imagick
root@user:~#

Restarting the apache web server:

apachectl restart

CentOS

Installing Imagemagick

Executing the command:

yum install ImageMagick

We check the correctness of the installation:

[root@user ~]# convert -version

Version: ImageMagick 6.9.10-68 Q16 x86_64 2021-10-14 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(3.1)
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff wmf x xml zlib

Installing php-imagick

We run the following commands in the console:

yum install make gcc
yum install php-devel php-pear ImageMagick-devel

Installing the imagick extension (if php < 5.4):

pecl install imagick-3.1.2

If there is a newer version of PHP:

pecl install imagick

When requesting

Please provide the prefix of Imagemagick installation [autodetect] :

press Enter.

At the end of the installation, we will see a text with a suggestion to add a line extension=imagick.so in php.ini

You should add "extension=imagick.so" to php.ini

Executing the command:

echo 'extension=imagick.so' > /etc/php.d/imagick.ini

Checking it out:

#php -m |grep imagick
imagick

Restarting the web server:

apachectl restart