Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
If you are running a Laravel project like Eventmie on XAMPP (LAMPP) in Ubuntu 24 and suddenly see this error:
Webp format is not supported by PHP installation.
You are not alone.
This issue happens frequently when:
- GD extension is enabled
- But WebP support inside GD is not compiled
- Or you are mixing system PHP and XAMPP PHP
- Or Ubuntu version mismatch causes confusion
- Or iconv compilation fails during rebuild
In this guide, I will explain everything in simple and practical terms:
- Why this happens
- How to check which PHP is actually running
- Why GD shows enabled but WebP is missing
- Why installing php8.3-gd does not fix XAMPP
- How to compile PHP with WebP support properly
- Why iconv throws “does not support errno”
- How to safely undo everything
- When to stop server-level fixing and move to code-level solution
This tutorial is based on a real production debugging scenario.
1. Understanding the Root Problem
The core error:
Webp format is not supported by PHP installation.
This comes from Intervention Image library (used by Eventmie).
Internally it tries:
$image->encode('webp', 90);
If your PHP GD does not support WebP, it throws:
Intervention\Image\Exception\NotSupportedException
Now the most confusing part:
You check GD and it says enabled.
But WebP Support is blank.
Example:
/opt/lampp/bin/php -r 'print_r(gd_info());'
Output:
[GD Version] => bundled (2.1.0 compatible)
[WebP Support] =>
Blank means:
WebP was NOT compiled inside GD.
2. First Important Question: Which PHP Is Actually Running?
This is critical.
Run:
which php
type -a php
php -v
If you see:
/opt/lampp/bin/php
Then you are using XAMPP PHP.
If you see:
/usr/bin/php
Then you are using system PHP.
Installing:
sudo apt install php8.3-gd
will NOT affect XAMPP PHP.
Because XAMPP is completely independent.
This is one of the biggest misconceptions.
3. Why Installing php8.3-gd Did Not Fix the Problem
You installed:
sudo apt install php8.3-gd
But your PHP version was:
PHP 8.2.12 (cli)
And it was coming from:
/opt/lampp/bin/php
That means:
System PHP 8.3 ≠ XAMPP PHP 8.2
So installing system packages does nothing for LAMPP.
This is where many developers get stuck.
4. How to Check If GD WebP Is Really Enabled
Run these three commands:
/opt/lampp/bin/php -m | grep -i gd
/opt/lampp/bin/php -r 'print_r(gd_info());'
/opt/lampp/bin/php -r 'var_dump(function_exists("imagewebp"));'
If you get:
bool(false)
Then WebP support is not compiled.
Even if configure command shows:
--with-webp
That does NOT guarantee WebP actually compiled successfully.
5. Why Ubuntu 24 Is Not the Real Problem
You asked:
Is Ubuntu 24 creating problem?
Answer:
No.
Ubuntu 24 supports PHP 8.3 officially.
But you are using:
XAMPP PHP 8.2
XAMPP bundles its own PHP binary and libraries.
Ubuntu version is irrelevant unless:
- Required development libraries are missing
- Or you are compiling PHP manually
So Ubuntu is not the root cause.
6. Can We Recompile XAMPP PHP With GD WebP?
Yes.
But it is advanced and risky.
You attempted:
- Download PHP 8.2.12 source
- Configure with –with-webp
- Build
- Install
And initially WebP was still false.
Later, after proper configuration, you got:
bool(true)
[WebP Support] => 1
That means compilation succeeded.
But then iconv error appeared.
7. The iconv Error: “iconv does not support errno”
During configure, you saw:
checking if iconv supports errno... no
configure: error: iconv does not support errno
This happens because:
- glibc iconv behaves differently
- PHP configure expects certain behavior
- Ubuntu 24 environment sometimes fails that test
Solutions usually involve:
- Forcing cache variable
- Installing GNU libiconv manually
- Exporting CPPFLAGS and LDFLAGS
But this increases complexity significantly.
For production XAMPP server, recompiling PHP inside LAMPP is not beginner-friendly.
8. The Biggest Mistake Developers Make
Trying to “fix server” when application-level fallback is easier.
In your case:
Imagick was already working.
Test confirmed:
$im=new Imagick();
$im->setImageFormat("webp");
It successfully created WebP file.
But Eventmie was using GD driver, not Imagick.
So the real fix could be:
Change Intervention driver to Imagick.
Instead of rebuilding entire PHP stack.
9. Safe Undo – How to Revert Everything
If things get messy:
Delete test install:
sudo rm -rf /opt/lampp-webp-test
Delete source builds:
sudo rm -rf /usr/local/src/php-8.2.12
Clear environment variables:
unset PKG_CONFIG_PATH CPPFLAGS LDFLAGS LD_LIBRARY_PATH
hash -r
Restart XAMPP:
sudo /opt/lampp/lampp restart
Now you are back to original state.
10. The Smart Production Approach (Recommended)
Instead of rebuilding PHP:
Use one of these:
Option 1: Force Imagick Driver
In config/image.php:
'driver' => 'imagick',
Option 2: Fallback Logic
Wrap WebP encoding:
if (function_exists('imagewebp')) {
$image->encode('webp', 90);
} else {
$image->encode('jpg', 90);
}
This avoids server-level risk.
11. Final Decision Guide
If you are:
Beginner → Do NOT recompile PHP
Production server → Avoid manual rebuild
Using XAMPP → Never mix system PHP packages
Already have Imagick → Use Imagick driver
Need WebP strictly via GD → Compile carefully in isolated environment

Leave a Reply