Enable Webp support for PHP7.0 using EasyApache 4

Amro Abu-Hmaidan

Registered
Feb 25, 2018
1
0
1
United Arab Emirates
cPanel Access Level
Root Administrator
I'm not an expert admin, and I'm actually a developer.

I have php7.0 with gd enabled, and I want to be able to call imagewebp() function in php, but it says that the version of php gd is not compiled with webp, I tried many ways to do that through WHM or even command line to no avail, can you please help guide me recompile the current version of php used by the server with all its current configuration and just adding only '--with-webp-dir=/usr'.

Any help is highly appreciated,
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

Can you verify which operating system is installed on this server? WebP support for PHP version 7 requires libwebp, which is only available on CentOS 7.

Thank you.
 

leonep

Well-Known Member
Nov 18, 2014
228
18
68
Pescara
cPanel Access Level
Root Administrator
Hi,
I want setup webp with imagick on my centos 6.
Package libwebp-0.4.3-3.el6.x86_64 already installed and latest version
Package ImageMagick-devel-6.7.2.7-6.el6.x86_64 already installed and latest version

i also installed php module using PECL
/opt/cpanel/ea-php72/root/usr/bin/pecl install imagick

but no success on phpinfo page.. i do not have the format "webp" in ImageMagick supported formats !!!!
any help please, thanks
 

Gareth-AWD

Well-Known Member
Jul 3, 2008
195
13
68
London, UK
cPanel Access Level
Root Administrator
Hi,
I want setup webp with imagick on my centos 6.
Package libwebp-0.4.3-3.el6.x86_64 already installed and latest version
Package ImageMagick-devel-6.7.2.7-6.el6.x86_64 already installed and latest version

i also installed php module using PECL
/opt/cpanel/ea-php72/root/usr/bin/pecl install imagick

but no success on phpinfo page.. i do not have the format "webp" in ImageMagick supported formats !!!!
any help please, thanks
Depending on your repositories, you need to install ImageMagick 6.9 or 7 to get it working with webp.

The bad news is that webp is broken with ImageMagic 6.9 and 7 build 68 and they are putting a fix in place with the next release. It currently produces a corrupted image if you do any manipulation. It works if you want to just convert jpeg to webp without resizing. It should be any day now they release build 69.

To install ImageMagick 6.9 I did the following on my CentOS

- yum install ImageMagick6-devel
- type convert --version and check webp is in the supported list
- Install the pecl module as you did
- Restart Apache
- If you use PHP-FPM restart that too.

It should show in modules list on your php info page.
 

leonep

Well-Known Member
Nov 18, 2014
228
18
68
Pescara
cPanel Access Level
Root Administrator
Thanks for help,
with ImageMagick i can work from command line with webp , the problem is in php .
when i install imagick with pecl this it not support format webp (in phpinfo page i not found webp on supported formats)
i have also try to manual compile from sources..

at final i decided to use graphicmagic with php gmagick and i got webp support working
i have used a patch ( timebug/graphicsmagick-webp-patch )
i hope this help someone !

my last question :
what is the best for manipulate images? imagimagick or graphicmagic? and what are the differences?
regards