How to Fix “WebP Format is Not Supported by PHP Installation” in XAMPP/LAMPP (Complete 2026 Guide)

Posted by

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

If you are running Laravel, Eventmie, or any application using Intervention Image, and you see this error:

Webp format is not supported by PHP installation

then your PHP installation does not support WebP encoding.

This problem is extremely common on Linux servers using XAMPP or LAMPP, especially with PHP 8.x.

In this complete step-by-step guide, you will learn:

  • Why this error happens
  • How to confirm the real root cause
  • How to safely fix it without breaking your server
  • How to enable WebP support using Imagick
  • How to force Laravel / Intervention to use Imagick instead of GD
  • What NOT to do on production

This tutorial is written specifically for Linux servers using /opt/lampp.


Why This Error Happens

Intervention Image supports two drivers:

  • GD
  • Imagick

When you call:

$image->encode('webp', 90);

Intervention tries to encode the image in WebP format.

If your PHP GD library was compiled without WebP support, you get:

Webp format is not supported by PHP installation

Important:

WebP support in GD is a compile-time feature.
It cannot be enabled via php.ini.


Step 1 – Confirm the Root Cause

Run the following commands:

/opt/lampp/bin/php -m | grep -i gd

If GD appears, check its capabilities:

/opt/lampp/bin/php -r 'print_r(gd_info());'

If you see:

[WebP Support] =>

That means GD does NOT support WebP.

Now confirm Apache is using XAMPP PHP:

/opt/lampp/bin/httpd -M | grep -i php

If you see:

php_module (shared)

Then Apache is using XAMPP’s built-in PHP.

At this point, the issue is confirmed:
GD does not support WebP.


All Possible Solutions

There are three ways to solve this.

  1. Disable WebP encoding in your application (quick fix)
  2. Install Imagick and use it instead of GD (recommended)
  3. Rebuild PHP with WebP support (risky and not recommended)

We will implement Solution 2 because it is the safest long-term fix.


Solution 1 – Quick Fix (Disable WebP Encoding)

If you need uploads to work immediately, change this line in:

eventmie-pro/src/Http/Controllers/Voyager/SettingsController.php

Replace:

$image->encode('webp', 90);

With:

$image->encode('jpg', 90);

Then clear cache:

cd /opt/lampp/htdocs/your-project
/opt/lampp/bin/php artisan config:clear
/opt/lampp/bin/php artisan cache:clear
sudo /opt/lampp/lampp restart

This fixes uploads instantly but removes WebP support.


Solution 2 – Enable WebP Properly Using Imagick (Recommended)

This is the correct professional solution.


Step 2.1 – Install Required System Packages

sudo apt update
sudo apt install -y imagemagick libmagickwand-dev libwebp-dev

Step 2.2 – Install Imagick for XAMPP PHP

Run:

/opt/lampp/bin/pecl install imagick

If installation completes successfully, you will see:

install ok: channel://pecl.php.net/imagick

Step 2.3 – Enable Imagick in XAMPP PHP

First backup your php.ini:

sudo cp -a /opt/lampp/etc/php.ini /opt/lampp/etc/php.ini.backup

Then add the extension:

echo "extension=imagick.so" | sudo tee -a /opt/lampp/etc/php.ini

Step 2.4 – Restart XAMPP

sudo /opt/lampp/lampp restart

Step 2.5 – Verify Imagick is Working

Check:

/opt/lampp/bin/php -m | grep -i imagick

You should see:

imagick

Now confirm WebP support:

/opt/lampp/bin/php -r 'echo in_array("WEBP", \Imagick::queryFormats()) ? "WEBP OK\n" : "WEBP MISSING\n";'

If you see:

WEBP OK

Your server now supports WebP via Imagick.


Step 3 – Force Laravel / Intervention to Use Imagick

Even after installing Imagick, your app may still use GD.

Check if this file exists:

config/image.php

If it exists, open it:

nano config/image.php

Change:

'driver' => 'gd',

To:

'driver' => 'imagick',

Then clear Laravel config:

cd /opt/lampp/htdocs/your-project
/opt/lampp/bin/php artisan config:clear
/opt/lampp/bin/php artisan cache:clear

Restart XAMPP:

sudo /opt/lampp/lampp restart

Now your application will use Imagick instead of GD.


Step 4 – Final WebP Test

Run this test:

cd /opt/lampp/htdocs/your-project

/opt/lampp/bin/php -r '
require "vendor/autoload.php";
use Intervention\Image\ImageManager;
$m = new ImageManager(["driver"=>"imagick"]);
$img = $m->canvas(120, 80, "#ff9900");
$img->encode("webp", 90);
echo "WebP encoding successful\n";
'

If you see:

WebP encoding successful

The issue is completely resolved.


Why You Should NOT Rebuild GD on Production

Rebuilding PHP with:

--with-webp

requires:

  • Downloading PHP source
  • Compiling against XAMPP Apache
  • Overwriting PHP binaries
  • Risking Apache failure
  • Possible segmentation faults

This is high-risk and unnecessary when Imagick works perfectly.


Best Practice for Production Servers

For long-term stability, consider moving away from XAMPP on Linux.

Recommended production stack:

  • Ubuntu Server
  • Nginx or Apache
  • PHP-FPM
  • php8.2-gd
  • php8.2-imagick

Install using:

sudo apt install php8.2-gd php8.2-imagick

This gives stable, package-managed WebP support.


Final Summary

If you see:

WebP format is not supported by PHP installation

The problem is almost always:

GD compiled without WebP support.

The safest solution is:

Install Imagick
Enable it in php.ini
Switch Intervention driver to imagick

This method avoids rebuilding PHP and prevents server instability.

Leave a Reply

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

0
Would love your thoughts, please comment.x
()
x