{"componentChunkName":"component---src-templates-blog-post-js","path":"/php86-replace-pecl-with-pie/","result":{"data":{"site":{"siteMetadata":{"title":"Blog","websiteTitle":"Sebastian Hagens - Creative technologist","siteUrl":"https://sebastix.nl/blog","canonicalUrl":"https://sebastix.nl","defaultImage":"images/social-default.jpg","author":{"name":"Sebastian Hagens","summary":"creative technologist"},"social":{"twitter":"sebastix","linkedin":"sebastianhagens","github":"sebastix","gitlab":"sebastix","mastodon":"https://nwb.social/@sebastian","nostr":"https://nostr.com/npub1qe3e5wrvnsgpggtkytxteaqfprz0rgxr8c3l34kk3a9t7e2l3acslezefe"}}},"markdownRemark":{"id":"177fc27e-4155-5992-841f-dfde98a5ed13","excerpt":"Short answer: the official  Docker images are no longer built with , so the  command is gone and every  fails with . Replace it with , using PIE, the PHP…","html":"<p><strong>Short answer:</strong> the official <code class=\"language-text\">php:8.6</code> Docker images are no longer built with <code class=\"language-text\">--with-pear</code>, so the <code class=\"language-text\">pecl</code> command is gone and every <code class=\"language-text\">RUN pecl install xdebug</code> fails with <code class=\"language-text\">pecl: not found</code>. Replace it with <code class=\"language-text\">pie install xdebug/xdebug</code>, using <a href=\"https://github.com/php/pie\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">PIE</a>, the PHP Installer for Extensions. PECL itself has been formally deprecated since September 2025 (<a href=\"https://wiki.php.net/rfc/adopt_pie_deprecate_pecl\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">RFC</a>).</p>\n<h2>The error: <code class=\"language-text\">pecl: not found</code></h2>\n<p>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:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">> [3/8] RUN pecl install xdebug:\n0.106 /bin/sh: pecl: not found</code></pre></div>\n<p>This is not a missing package you can <code class=\"language-text\">apk add</code> or <code class=\"language-text\">apt install</code>: there is no <code class=\"language-text\">pecl</code> binary in the image at all.</p>\n<h2>Why PECL is missing in PHP 8.6</h2>\n<p>Two things happened:</p>\n<ol>\n<li><strong>PECL is deprecated.</strong> The accepted RFC <em>Recommend PIE and deprecate PECL</em> (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.</li>\n<li><strong>The official Docker images dropped the installers.</strong> PHP 8.6.0 (released November 2026) images are built without <code class=\"language-text\">--with-pear</code> (<a href=\"https://github.com/docker-library/php/pull/1654\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">docker-library/php#1654</a>), so both <code class=\"language-text\">pecl</code> and <code class=\"language-text\">pear</code> are absent from <code class=\"language-text\">php:8.6-alpine</code>, <code class=\"language-text\">php:8.6-apache</code> and the other 8.6 variants. <code class=\"language-text\">phpize</code>, <code class=\"language-text\">php-config</code> and the <code class=\"language-text\">docker-php-ext-*</code> helpers are still there.</li>\n</ol>\n<h2>TL;DR: what to change</h2>\n<p>Replace <code class=\"language-text\">RUN pecl install xdebug</code> with a bind-mounted <code class=\"language-text\">pie</code> binary:</p>\n<div class=\"gatsby-highlight\" data-language=\"dockerfile\"><pre class=\"language-dockerfile\"><code class=\"language-dockerfile\"><span class=\"token instruction\"><span class=\"token keyword\">RUN</span> <span class=\"token options\"><span class=\"token property\">--mount</span><span class=\"token punctuation\">=</span><span class=\"token string\">type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie</span></span> <span class=\"token operator\">\\</span>\n    pie install --no-cache xdebug/xdebug</span></code></pre></div>\n<p><code class=\"language-text\">docker-php-ext-enable xdebug</code> is no longer needed: PIE enables the extension in <code class=\"language-text\">php.ini</code> itself.</p>\n<h2>Before: installing Xdebug with PECL</h2>\n<div class=\"gatsby-highlight\" data-language=\"dockerfile\"><pre class=\"language-dockerfile\"><code class=\"language-dockerfile\"><span class=\"token instruction\"><span class=\"token keyword\">FROM</span> php:8.6-alpine</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apk add --no-cache --update build-base linux-headers autoconf</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> pecl install xdebug</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> docker-php-ext-enable xdebug</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">WORKDIR</span> /app</span></code></pre></div>\n<h2>After: installing Xdebug with PIE</h2>\n<p>Here is what I changed to fix this in a simple Dockerfile:</p>\n<div class=\"gatsby-highlight\" data-language=\"dockerfile\"><pre class=\"language-dockerfile\"><code class=\"language-dockerfile\"><span class=\"token instruction\"><span class=\"token keyword\">FROM</span> php:8.6-alpine</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> apk add --no-cache --update build-base linux-headers autoconf libtool</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> <span class=\"token options\"><span class=\"token property\">--mount</span><span class=\"token punctuation\">=</span><span class=\"token string\">type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie</span></span> <span class=\"token operator\">\\</span>\n    set -eux; <span class=\"token operator\">\\</span>\n    <span class=\"token comment\"># Use PIE to install extensions here</span>\n    pie install --no-cache xdebug/xdebug:3.6.0alpha1;</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> php -m | grep -i xdebug</span>\n\n<span class=\"token instruction\"><span class=\"token keyword\">WORKDIR</span> /app</span></code></pre></div>\n<p>What happens in that second <code class=\"language-text\">RUN</code> step:</p>\n<ol>\n<li><code class=\"language-text\">--mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie</code> mounts the <code class=\"language-text\">pie</code> 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.</li>\n<li><code class=\"language-text\">pie install xdebug/xdebug</code> downloads the extension from Packagist, compiles it with the build tools you just installed, and enables it in <code class=\"language-text\">php.ini</code>.</li>\n<li><code class=\"language-text\">--no-cache</code> keeps the Composer cache out of the layer, which keeps the image small and the build reproducible.</li>\n<li><code class=\"language-text\">libtool</code> is added to the build dependencies because PIE compiles extensions just like <code class=\"language-text\">pecl</code> did. <code class=\"language-text\">php:8.6-alpine</code> already exposes that set as <code class=\"language-text\">$PHPIZE_DEPS</code>, so <code class=\"language-text\">RUN apk add --no-cache $PHPIZE_DEPS</code> is the shorter and more future-proof alternative.</li>\n</ol>\n<p>Xdebug only supports PHP 8.6 from version 3.6 onwards, which is why I pinned <code class=\"language-text\">3.6.0alpha1</code> here. Once 3.6 is stable you can drop the version and use <code class=\"language-text\">pie install --no-cache xdebug/xdebug</code>.</p>\n<p>If you run <code class=\"language-text\">docker build --progress=plain --no-cache -f Dockerfile .</code> you can inspect all logs of the image being built. The final <code class=\"language-text\">RUN php -m | grep -i xdebug</code> makes the build fail when the extension was not enabled, which catches problems early.</p>\n<h2>PECL vs PIE</h2>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>PECL</th>\n<th>PIE</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Install command</td>\n<td><code class=\"language-text\">pecl install xdebug</code></td>\n<td><code class=\"language-text\">pie install xdebug/xdebug</code></td>\n</tr>\n<tr>\n<td>Package naming</td>\n<td>extension name</td>\n<td>Composer <code class=\"language-text\">vendor/package</code></td>\n</tr>\n<tr>\n<td>Package registry</td>\n<td>pecl.php.net</td>\n<td>Packagist (<code class=\"language-text\">packagist.org/extensions</code>)</td>\n</tr>\n<tr>\n<td>Available in the <code class=\"language-text\">php:8.6</code> image</td>\n<td>no, built without <code class=\"language-text\">--with-pear</code></td>\n<td>no, bind-mounted from <code class=\"language-text\">ghcr.io/php/pie:bin</code></td>\n</tr>\n<tr>\n<td>Enabling the extension</td>\n<td><code class=\"language-text\">docker-php-ext-enable</code></td>\n<td>built into PIE</td>\n</tr>\n<tr>\n<td>Status</td>\n<td>deprecated since September 2025</td>\n<td>recommended replacement</td>\n</tr>\n</tbody>\n</table>\n<p>PIE is only for extensions that are <em>not</em> bundled with PHP, like Xdebug. For extensions that ship with PHP itself (GD, Intl, and friends) you still use <code class=\"language-text\">docker-php-ext-install</code>, exactly as before.</p>\n<h2>Pinning versions and pre-releases</h2>\n<p>PIE accepts the Composer constraint syntax <code class=\"language-text\">{vendor/package}:{constraint}{@stability}</code>:</p>\n<div class=\"gatsby-highlight\" data-language=\"dockerfile\"><pre class=\"language-dockerfile\"><code class=\"language-dockerfile\"><span class=\"token comment\"># Latest stable release</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> ... pie install --no-cache xdebug/xdebug</span>\n\n<span class=\"token comment\"># Any 3.6 release, including pre-releases</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> ... pie install --no-cache xdebug/xdebug:^3.6@alpha</span>\n\n<span class=\"token comment\"># One exact version</span>\n<span class=\"token instruction\"><span class=\"token keyword\">RUN</span> ... pie install --no-cache xdebug/xdebug:3.6.0alpha1</span></code></pre></div>\n<p>Add <code class=\"language-text\">@alpha</code> or <code class=\"language-text\">@beta</code> when you want a pre-release: with the default <code class=\"language-text\">stable</code> stability, pre-release versions are skipped. All extensions you can install with PIE are listed here: <a href=\"https://packagist.org/extensions\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://packagist.org/extensions</a>.</p>\n<h2>FAQ</h2>\n<p><strong>Is PECL removed or only deprecated?</strong>\nBoth, 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: <code class=\"language-text\">php:8.6</code> is built without <code class=\"language-text\">--with-pear</code>, so there is no <code class=\"language-text\">pecl</code> binary inside the container anymore.</p>\n<p><strong>Do I need Composer installed in the image?</strong>\nNo. <code class=\"language-text\">pie</code> is a self-contained phar that only needs the <code class=\"language-text\">php</code> binary; you don’t need Composer, a <code class=\"language-text\">composer.json</code> or a project inside the image.</p>\n<p><strong>How do I find the right package name?</strong>\nUse <code class=\"language-text\">pie search xdebug</code> or <code class=\"language-text\">pie info xdebug/xdebug</code>, or browse <a href=\"https://packagist.org/extensions\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://packagist.org/extensions</a>. The format is always <code class=\"language-text\">vendor/package</code>, for example <code class=\"language-text\">xdebug/xdebug</code> or <code class=\"language-text\">phpredis/phpredis</code>.</p>\n<p><strong>Can I still use PECL on PHP 8.5 and older?</strong>\nYes, the 8.5 images are still built with <code class=\"language-text\">--with-pear</code>. Migrate anyway, so your Dockerfile keeps working when you upgrade the base image.</p>\n<p><strong>How do I list, upgrade or remove extensions installed with PIE?</strong>\n<code class=\"language-text\">pie show</code> lists what PIE installed, <code class=\"language-text\">pie upgrade</code> updates to the latest allowed versions and <code class=\"language-text\">pie uninstall xdebug/xdebug</code> disables and removes an extension.</p>\n<p><strong>Can I use PIE outside Docker?</strong>\nYes. Install the phar once (<code class=\"language-text\">curl -LsSf https://github.com/php/pie/releases/latest/download/pie.phar -o /usr/local/bin/pie</code>) and run the same <code class=\"language-text\">pie install</code> commands. In CI pipelines add <code class=\"language-text\">--no-interaction</code> so the build never waits for a prompt.</p>\n<h2>Related posts</h2>\n<ul>\n<li><a href=\"https://sebastix.nl/blog/access-data-files-and-directories-of-your-docker-volumes-on-your-host/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Access data files and directories of your Docker volumes on your host</a></li>\n<li><a href=\"https://sebastix.nl/blog/apple-m1-chip-en-docker/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Apple M1 chip en Docker</a></li>\n</ul>","frontmatter":{"title":"Replace PECL with PIE in PHP 8.6 Docker images","date":"2026-11-25T13:13:32.760Z","description":"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."},"fields":{"lang":"en","categories":["PHP Docker"],"tags":[],"image":"","updated":"","readingTime":{"text":"5 min read","words":963}}}},"pageContext":{"slug":"/php86-replace-pecl-with-pie/","previous":{"fields":{"slug":"/hoe-ai-agents-een-nieuwe-manier-van-communicatie-met-systemen-nodig-hebben/"},"frontmatter":{"title":"Hoe AI agents een nieuwe manier van communicatie met systemen nodig hebben"}},"next":{"fields":{"slug":"/prijzen-aanbod-2027/"},"frontmatter":{"title":"Mijn aanbod met tarieven in 2027"}}}},"staticQueryHashes":["2761732123","58764424","637681966"]}