Replace PECL with PIE in PHP 8.6 Docker images

woensdag 25 november 2026 - 963 woorden, 5 min read

PHP 8.6 Docker images no longer ship pecl, so pecl install fails with 'pecl: not found'. Install Xdebug and other extensions with PIE instead.

Short answer: the official php:8.6 Docker images are no longer built with --with-pear, so the pecl command is gone and every RUN pecl install xdebug fails with pecl: not found. Replace it with pie install xdebug/xdebug, using PIE, the PHP Installer for Extensions. PECL itself has been formally deprecated since September 2025 (RFC).

The error: pecl: not found

I’m working with several Dockerfiles where I used PECL to install additional PHP extensions, like Xdebug. Since PHP 8.6, building such an image fails with an error like this:

> [3/8] RUN pecl install xdebug:
0.106 /bin/sh: pecl: not found

This is not a missing package you can apk add or apt install: there is no pecl binary in the image at all.

Why PECL is missing in PHP 8.6

Two things happened:

  1. PECL is deprecated. The accepted RFC Recommend PIE and deprecate PECL (August 2025) makes PIE the recommended way to install non-bundled PHP extensions. The PECL tool and website still work for now, but you should not build new workflows on them.
  2. The official Docker images dropped the installers. PHP 8.6.0 (released November 2026) images are built without --with-pear (docker-library/php#1654), so both pecl and pear are absent from php:8.6-alpine, php:8.6-apache and the other 8.6 variants. phpize, php-config and the docker-php-ext-* helpers are still there.

TL;DR: what to change

Replace RUN pecl install xdebug with a bind-mounted pie binary:

RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
    pie install --no-cache xdebug/xdebug

docker-php-ext-enable xdebug is no longer needed: PIE enables the extension in php.ini itself.

Before: installing Xdebug with PECL

FROM php:8.6-alpine

RUN apk add --no-cache --update build-base linux-headers autoconf
RUN pecl install xdebug

RUN docker-php-ext-enable xdebug

WORKDIR /app

After: installing Xdebug with PIE

Here is what I changed to fix this in a simple Dockerfile:

FROM php:8.6-alpine

RUN apk add --no-cache --update build-base linux-headers autoconf libtool

RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
    set -eux; \
    # Use PIE to install extensions here
    pie install --no-cache xdebug/xdebug:3.6.0alpha1;

RUN php -m | grep -i xdebug

WORKDIR /app

What happens in that second RUN step:

  1. --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie mounts the pie phar from the official PIE image into the build container. Nothing is added to the final image, and you always build with a recent PIE version.
  2. pie install xdebug/xdebug downloads the extension from Packagist, compiles it with the build tools you just installed, and enables it in php.ini.
  3. --no-cache keeps the Composer cache out of the layer, which keeps the image small and the build reproducible.
  4. libtool is added to the build dependencies because PIE compiles extensions just like pecl did. php:8.6-alpine already exposes that set as $PHPIZE_DEPS, so RUN apk add --no-cache $PHPIZE_DEPS is the shorter and more future-proof alternative.

Xdebug only supports PHP 8.6 from version 3.6 onwards, which is why I pinned 3.6.0alpha1 here. Once 3.6 is stable you can drop the version and use pie install --no-cache xdebug/xdebug.

If you run docker build --progress=plain --no-cache -f Dockerfile . you can inspect all logs of the image being built. The final RUN php -m | grep -i xdebug makes the build fail when the extension was not enabled, which catches problems early.

PECL vs PIE

PECL PIE
Install command pecl install xdebug pie install xdebug/xdebug
Package naming extension name Composer vendor/package
Package registry pecl.php.net Packagist (packagist.org/extensions)
Available in the php:8.6 image no, built without --with-pear no, bind-mounted from ghcr.io/php/pie:bin
Enabling the extension docker-php-ext-enable built into PIE
Status deprecated since September 2025 recommended replacement

PIE is only for extensions that are not bundled with PHP, like Xdebug. For extensions that ship with PHP itself (GD, Intl, and friends) you still use docker-php-ext-install, exactly as before.

Pinning versions and pre-releases

PIE accepts the Composer constraint syntax {vendor/package}:{constraint}{@stability}:

# Latest stable release
RUN ... pie install --no-cache xdebug/xdebug

# Any 3.6 release, including pre-releases
RUN ... pie install --no-cache xdebug/xdebug:^3.6@alpha

# One exact version
RUN ... pie install --no-cache xdebug/xdebug:3.6.0alpha1

Add @alpha or @beta when you want a pre-release: with the default stable stability, pre-release versions are skipped. All extensions you can install with PIE are listed here: https://packagist.org/extensions.

FAQ

Is PECL removed or only deprecated? Both, in a way. PECL is formally deprecated as the recommended installation method, but the PECL tool and website keep working for now. What broke for me is the Docker image: php:8.6 is built without --with-pear, so there is no pecl binary inside the container anymore.

Do I need Composer installed in the image? No. pie is a self-contained phar that only needs the php binary; you don’t need Composer, a composer.json or a project inside the image.

How do I find the right package name? Use pie search xdebug or pie info xdebug/xdebug, or browse https://packagist.org/extensions. The format is always vendor/package, for example xdebug/xdebug or phpredis/phpredis.

Can I still use PECL on PHP 8.5 and older? Yes, the 8.5 images are still built with --with-pear. Migrate anyway, so your Dockerfile keeps working when you upgrade the base image.

How do I list, upgrade or remove extensions installed with PIE? pie show lists what PIE installed, pie upgrade updates to the latest allowed versions and pie uninstall xdebug/xdebug disables and removes an extension.

Can I use PIE outside Docker? Yes. Install the phar once (curl -LsSf https://github.com/php/pie/releases/latest/download/pie.phar -o /usr/local/bin/pie) and run the same pie install commands. In CI pipelines add --no-interaction so the build never waits for a prompt.

Related posts


Sebastian Hagens @Sebastix
I am a creative technologist and care about digital freedoms. Follow me:
or send me a message using my contact page.