I am trying to add WebP to ImageMagick supported formats for PHP 7.3 on a WHM dedicated server. Whenever I was adding this question I saw other posts related to this problem but they don't have a solution as I tried everybody's recommendations from those answers.
Here is what the deal is. I want to be able to serve images in WebP format on all our websites hosted on our server. So I installed some plugins to do that but they are trowing this warning which is saying that WebP is a missing ImageMagick format. Well, whenever I am checking PHPINFO under ImageMagick supported formats WebP is really missing.
I am also getting this Notification from that plugin: EWWW Image Optimizer requires exec() to perform local compression. Your system administrator has disabled the exec() function, ask them to enable it.
So I went under the main PHP INI file and under disable_functions = I we don't have any function assigned.
So first I tried to install just libwebp library like this:
$ wget -c https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-0.6.1-linux-x86-32.tar.gz
$ tar -xvf libwebp-0.6.1-linux-x86-32.tar.gz
$ cd libwebp-0.6.1-linux-x86-32/
$ cd bin/
$ ls
After ls command I get this:
Ok, it is on the server, it is installed but it doesn't show up under ImageMagick supported formats so I tried to Install ImageMagick again from Unix Source.
After download I did tar xvzf ImageMagick.tar.gz
Next configure and compile ImageMagick.
$ cd ImageMagick-7.0.8
$ ./configure
$ make
Install
sudo make install
Configured the dynamic linker run-time bindings:
sudo ldconfig /usr/local/lib
And then I wanted to run the ImageMagick validation suite:
make check
All this worked without any complaint or errors but whenever I check PHPINFO it still doesn't show any changes. What am I doing wrong here? How can I configure the PHP or what am I missing?
Thank you!
Before going further, remove all webp previous installation.
To install Imagick with webp support you should:
Install wepb from source:
wget http://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz
tar xvzf libwebp-1.1.0.tar.gz
cd libwebp-1.1.0
./configure
make && sudo make install
Install Imagick from source with webp support:
wget https://imagemagick.org/download/ImageMagick.tar.gz
./configure --with-webp=yes
sudo make && sudo make install
Install Imagick using PECL:
sudo pecl install imagick
sudo echo "extension=gmagick.so" > sudo /etc/php/7.3/apache2/conf.d/20-imagick.ini
sudo apache2ctl restart
To check if it works from the CLI:
php -r "print_r(Imagick::queryFormats());"
And you should see "WEBP" in the list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With