How to Compile the Imagick PHP Extension with webp Support

Sometimes the lsphp-imagick package does not contain the latest features. If this is the case, you can manually compile the extension to the latest version.

Step 1: Compile libwebp

yum install libjpeg-devel libpng-devel libtiff-devel giflib-devel

wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz

tar xzvf libwebp-1.1.0.tar.gz

cd libwebp-1.1.0

./configure

make

make install

Step 2: Compile Imagick with Webp Support

wget https://imagemagick.org/download/ImageMagick.tar.gz

tar xzvf ImageMagick.tar.gz

cd ImageMagick*

./configure --with-webp=yes

make

make install

Step 3: Compile PHP Extension

As Imagick requires a lot of dependencies , we could use

 yum install lsphp73-imagick

to install it , and then upgrade it.

wget http://pecl.php.net/get/imagick

tar xzvf imagick

cd imagick-*

/usr/local/lsws/lsphp73/bin/phpize

./configure --with-php-config=/usr/local/lsws/lsphp73/bin/php-config

make

make install

and restart lsphp process if necessary.

  • Admin
  • Last modified: 2020/01/09 22:55
  • by qtwrk