3

I am trying to enable WebP support for GD through WHM.

Currently I am getting version 2.1.0 (2.5.5 is stable) and when I check PHP info WebP support is not enabled.

Can I enable this using WHM?

I am not experienced with servers and I am using WHM settings.

flinch85
  • 340
  • 2
  • 16

2 Answers2

2

PHP needs to be compiled to support it.

To enable support for webp add --with-vpx-dir=DIR . Available as of PHP 5.4.0. As of PHP 7.0.0 --with-webp-dir=DIR has to be added, i.e. support for libvpx has been removed in favor of libwebp.

https://www.php.net/manual/en/image.installation.php

Of course, your server will also need either libvpx or libwebp installed.

delboy1978uk
  • 12,118
  • 2
  • 21
  • 39
  • Thank you, unfortunately my host tells me that they cannot recompile PHP as we are using cPanel. Is that correct? – flinch85 Feb 25 '20 at 15:28
  • 1
    Not so much that they can't, but it's probably a hassle for them. Depends on their infrastructure, but they might have their websites down for a while, or they just want to have a backup for everything before they do this, and the backing up takes a long long time. Option 1: You give up on having it. Option 2: Persevere so long that they decide to do it. Option 3: Change hosting provider. – s3c Jul 28 '21 at 17:21
  • I realised that of course, the dependency `libvpx-dev` needs to be added as well (`apt-get install libvpx-dev`) (if you're under php@7.0.0) – Marcosaurios Feb 13 '23 at 15:06
1

Instead of recompiling PHP, you can use the official WebP package to generate WebP images. Just download the package depending on your server OS. Extract it and upload it to public_html folder. Using shell_exec command you can generate WebP images from png, jpg etc. No root access or package needs to install. For more information follow the tutorial on enable-webp-support-php-7. Hope it help.

Code Book
  • 21
  • 3