Install ImageMagick on RHEL / CentOS system and install Imagick extension on PHP

ImageMagick is an open source image processing tool that can create, edit and convert image files in command mode. It supports more than 200 image formats, such as JPEG, GIF, PNG, TIFF, etc. If PHP wants to use ImageMagick, the best way is to install ImageMagick's PHP extension Imagick.

ImageMagick Install PHP's Imagick extension in WordPress

It is an open source image processing tool that can create, edit and convert image files in command mode. It supports more than 200 image formats, such as JPEG, GIF, PNG, TIFF, etc. If you want to use ImageMagick in PHP, in addition to running ImageMagick in PHP, the best way is to install the PHP extension Imagick of ImageMagick. Imagick can create and edit images through the ImageMagick API, and ImageMagick and Imagick are also recommended packages for WordPress to install.

RHEL / CentOS system, WordPress installation PHP extension ImageMagick-1

First install php-pear, php-devel and gcc:

# dnf install php-pear php-devel gcc

After installing the above packages, install ImageMagick:

# dnf install ImageMagick ImageMagick-devel ImageMagick-perl

If you are using RHEL 8 or CentOS 8, you need to install the GraphicsMagick package instead. GraphicsMagick is a branch of ImageMagick. Use the following command to install it:

# dnf install GraphicsMagick GraphicsMagick-devel GraphicsMagick-perl

After installing ImageMagick or GraphicsMagick, you can install the Imagick PHP extension by executing the following command:

# pecl install imagick

The system will ask the following questions:

Please provide the prefix of Imagemagick installation [autodetect] :

Simply press the Enter key.

After installation, you need to add the imagick.so extension to php.ini and execute the following command:

# echo extension=imagick.so >> /etc/php.ini

Execute the following command to confirm that the imagick installation is complete:

# php -m | grep imagick

If the response is "imagick”, it means the installation is successful.

Finally restart the system

 

1/5 - (1 vote)

Leave a Reply

Your email address will not be published. Required fields are marked *