Reconfigure PHP 8.2.12 for XAMPP WITH WebP

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

Great — TEST build success
Now we have exactly what we need:

  • imagewebp() = true
  • GD WebP Support = 1

So your server can run PHP 8.2.12 with GD+WebP.
Next step is to put this into XAMPP (/opt/lampp) safely.

Below is the production-safe swap plan with rollback.


Step A — Take a full backup of current XAMPP PHP

TS="$(date +%F-%H%M)"
sudo mkdir -p /root/xampp-php-backup-$TS

sudo cp -a /opt/lampp/bin/php /root/xampp-php-backup-$TS/
sudo cp -a /opt/lampp/bin/phpize* /root/xampp-php-backup-$TS/ 2>/dev/null || true
sudo cp -a /opt/lampp/bin/php-config* /root/xampp-php-backup-$TS/ 2>/dev/null || true
sudo cp -a /opt/lampp/modules/libphp*.so /root/xampp-php-backup-$TS/ 2>/dev/null || true
sudo cp -a /opt/lampp/etc/php.ini /root/xampp-php-backup-$TS/
sudo cp -a /opt/lampp/lib/php/extensions/no-debug-non-zts-20220829 /root/xampp-php-backup-$TS/extensions-20220829 2>/dev/null || true

echo "Backup saved at /root/xampp-php-backup-$TS"

Step B — Reconfigure PHP 8.2.12 for XAMPP (/opt/lampp) WITH WebP

Now we rebuild from the same source directory but install into /opt/lampp.

cd /usr/local/src/php-8.2.12

make distclean 2>/dev/null || true
rm -f config.cache

export PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig:/opt/lampp/lib/pkgconfig"
unset CPPFLAGS
unset LDFLAGS

./configure \
  --prefix=/opt/lampp \
  --with-apxs2=/opt/lampp/bin/apxs \
  --with-config-file-path=/opt/lampp/etc \
  --with-mysql=mysqlnd \
  --enable-inline-optimization \
  --disable-debug \
  --enable-bcmath \
  --enable-calendar \
  --enable-ctype \
  --enable-ftp \
  --enable-gd-native-ttf \
  --enable-magic-quotes \
  --enable-shmop \
  --disable-sigchild \
  --enable-sysvsem \
  --enable-sysvshm \
  --enable-wddx \
  --with-gdbm=/opt/lampp \
  --with-jpeg-dir=/opt/lampp \
  --with-png-dir=/opt/lampp \
  --with-freetype-dir=/opt/lampp \
  --with-zlib=yes \
  --with-zlib-dir=/opt/lampp \
  --with-openssl=/opt/lampp \
  --with-xsl=/opt/lampp \
  --with-ldap=/opt/lampp \
  --with-gd \
  --with-imap=/bitnami/xamppunixinstaller82stack-linux-x64/src/imap-2007e \
  --with-imap-ssl \
  --with-gettext=/opt/lampp \
  --with-mssql=shared,/opt/lampp \
  --with-pdo-dblib=shared,/opt/lampp \
  --with-sybase-ct=/opt/lampp \
  --with-mysql-sock=/opt/lampp/var/mysql/mysql.sock \
  --with-mcrypt=/opt/lampp \
  --with-mhash=/opt/lampp \
  --enable-sockets \
  --enable-mbstring=all \
  --with-curl=/opt/lampp \
  --enable-mbregex \
  --enable-zend-multibyte \
  --enable-exif \
  --with-bz2=/opt/lampp \
  --with-sqlite=shared,/opt/lampp \
  --with-sqlite3=/opt/lampp \
  --with-libxml-dir=/opt/lampp \
  --enable-soap \
  --with-xmlrpc \
  --enable-pcntl \
  --with-mysqli=mysqlnd \
  --with-pgsql=shared,/opt/lampp/ \
  --with-iconv \
  --with-pdo-mysql=mysqlnd \
  --with-pdo-pgsql=/opt/lampp/postgresql \
  --with-pdo_sqlite=/opt/lampp \
  --with-icu-dir=/opt/lampp \
  --enable-fileinfo \
  --enable-phar \
  --enable-zip \
  --enable-intl \
  --with-libzip \
  --with-pear \
  --enable-gd \
  --with-jpeg \
  --with-webp \
  --with-freetype \
  --with-zip

✅ Makefile check:

ls -l Makefile

Build + install:

make -j"$(nproc)"
sudo make install

Restart XAMPP:

sudo /opt/lampp/lampp restart

Step C — Verify XAMPP PHP now has WebP

/opt/lampp/bin/php -r 'var_dump(function_exists("imagewebp"));'
/opt/lampp/bin/php -r 'print_r(gd_info());' | grep -i webp

Expected:

  • bool(true)
  • WebP Support => 1

Step D — Verify Eventmie error is gone

Now your /admin/settings/update WebP encode will work.

Also clear Laravel caches:

cd /opt/lampp/htdocs/lucknoworbit.com
/opt/lampp/bin/php artisan optimize:clear

Instant Rollback (if anything breaks)

BK="$(ls -dt /root/xampp-php-backup-* | head -n 1)"
sudo cp -a "$BK/php" /opt/lampp/bin/php
sudo cp -a "$BK/php.ini" /opt/lampp/etc/php.ini
sudo cp -a "$BK"/libphp*.so /opt/lampp/modules/ 2>/dev/null || true
sudo /opt/lampp/lampp restart
echo "Rolled back from $BK"

Senior Software Development Engineer at Cotocus

Related Posts

Common DevSecOps Implementation Mistakes and How to Fix Them

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 Introduction…

Read More

Ultimate DevSecOps Learning Roadmap to Move from DevOps to Cloud Security

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 Introduction…

Read More

Comprehensive Guide to DevSecOps in Modern Software Engineering

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 Introduction…

Read More

DevSecOps in Modern Software Engineering: A Comprehensive Guide for Professionals

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 Introduction…

Read More

Strategies to Align DevSecOps With Agile and DevOps Practices

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 Introduction…

Read More

How to Fix Laravel Migration Error: Field ‘id’ Doesn’t Have a Default Value in the Migrations Table

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 Laravel…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments