Today i want to add on my website the support for webp images, and so i have found a plugin for wordpress that is free WebP Converter for Media

But for this plugin we must to active the support webp on the php module GD.
On My VPS i have installed PHP 7.4 on Plesk, the simple way is to change the modulo gd of plesk php version with a custom module in witch the webp support is enabled.

I have find this useful guide that i rewrite with php 7.4 that i have used on my VPS. 

Install the necessary package

# yum install make gcc plesk-php74-devel libjpeg-turbo-devel libpng-devel libXpm-devel freetype-devel libwebp-devel

Download PHP source. Note! Version of PHP source should be the same as your Plesk PHP version! For example, for PHP 7.4.4

# wget http://be2.php.net/get/php-7.4.4.tar.gz/from/this/mirror
# tar -xzf mirror
# cd php-7.4.4/ext/gd

Compile gd.so module

# /opt/plesk/php/7.4/bin/phpize
# ./configure --with-php-config=/opt/plesk/php/7.4/bin/php-config --with-webp --with-freetype --with-jpeg --with-xpm
# make

Replace original Plesk PHP gd.so module with compiled

# mv /opt/plesk/php/7.4/lib64/php/modules/gd.so /opt/plesk/php/7.4/lib64/php/modules/gd.so_orig
# cp modules/gd.so /opt/plesk/php/7.4/lib64/php/modules/
# plesk bin php_handler --reread

Check that all is OK

# /opt/plesk/php/7.4/bin/php -m | grep gd
gd

Do not forget to to make fake removal of original plesk-php74-gd package! Otherwise, your custom gd.so will be overwritten with next update.

# rpm -e --justdb plesk-php74-gd

 

At last remember that you must to go on
Plesk -> Tool & Setting -> PHP Settings
Choose your PHP Verison in this case PHP 7.4.4 and

  • Remove GD module and save
  • Add GD module and save

So Plesk rebuild php for the domains.

Tags:

Leave a Reply

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