Skip to content

Replace PECL with PIE for PHP 8.1+ images - #230

Merged
desrosj merged 5 commits into
trunkfrom
use-pie-for-extensions
Nov 10, 2026
Merged

desrosj merged 5 commits into
trunkfrom
use-pie-for-extensions

Conversation

@desrosj

@desrosj desrosj commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

PECL has been deprecated in favor of PIE (PHP Installer for Extensions), and pecl is no longer bundled with the PHP 8.6 base images. This switches extension installation to PIE for the PHP 8.1–8.5 images.

Changes

  • PHP 8.1–8.5: imagick, memcached, pcov, and xdebug are now installed with pie install using their Packagist packages:
    • imagick/imagick:3.8.1 (now pinned; it was previously unpinned)
    • php-memcached/php-memcached:3.4.0
    • pecl/pcov:1.0.12
    • xdebug/xdebug:3.5.3
  • PIE is bind-mounted for the RUN step only (the documented approach), so it is not shipped in the final images. The image is pinned by digest (ghcr.io/php/pie:1.5.5-bin@sha256:3fca03c1…), matching how this repository pins actions by SHA. This requires BuildKit, which is the default builder for docker build on ubuntu-latest.
  • --skip-enable-extension keeps the existing behavior: extensions are installed but not enabled, and entrypoint/common.sh enables them through LOCAL_PHP_XDEBUG, LOCAL_PHP_PCOV and LOCAL_PHP_MEMCACHED. Imagick is still enabled by default (PIE runs docker-php-ext-enable for it).
  • libtool is added to the 8.1–8.5 apt packages, because PIE warns when libtoolize is missing.

Not changed

  • PHP 7.4 and 8.0 continue to use PECL. PIE needs PHP 8.1+ to run. An experimental static PIE binary can target older PHP versions, but Xdebug 3.1.x (the last version supporting PHP 7.4) is not published for PIE; only Xdebug 3.4.0+ is. Both images still include pecl.
  • PHP 8.6 installs no extensions through PIE yet. Its image is unchanged apart from the reworded comment.
    • Xdebug is not installed on 8.6 today. Adding it (for example, xdebug/xdebug:3.6.0alpha1@alpha) is left for a separate PR.
    • The latest releases of PCOV (1.0.12), Memcached (3.4.0), and Imagick (3.8.1) don't compile against PHP 8.6, which removed several compatibility macros (INI_BOOL/INI_INT/INI_STR, XtOffsetOf, zval_dtor). Only released versions are installed, so they can be added once compatible releases are published.

Testing

The 8.1–8.5 images were built locally for linux/amd64, then checked:

Image Build Imagick on by default LOCAL_PHP_XDEBUG LOCAL_PHP_MEMCACHED LOCAL_PHP_PCOV PIE left in image
8.1–8.5 ✅ ✅ ✅ ✅ ✅ No

After pinning the PIE image by digest, the 8.5 and 8.6 images were rebuilt to confirm the pinned mount works. 8.5 still ships imagick, memcached, pcov, and xdebug, with only Imagick enabled, and 8.6 installs no extra extensions.

For 7.4, 8.0, and 8.6, the only change to the generated Dockerfiles is the reworded # install the required PHP extensions comment.

Notes for reviewers

  • While testing, PIE reported the php:8.6-rc-fpm image as thread-safe (8.6.0 ts, extension dir no-debug-zts-20260924), which is unusual for an -fpm variant. This doesn't affect the PR, but it may be worth a look.

🤖 Generated with Claude Code

https://claude.ai/code/session_011Y86gwJZGdkh78pggUy4zs

desrosj and others added 4 commits November 4, 2026 14:32
PECL is deprecated in favor of PIE (PHP Installer for Extensions), and
is no longer bundled with the PHP 8.6 base images.

- Install imagick, memcached, pcov, and xdebug with PIE on PHP 8.1-8.6.
- Bind-mount PIE from the pinned `ghcr.io/php/pie:1.5.5-bin` image so it
  is not shipped in the final images.
- Pass `--skip-enable-extension` to preserve the existing behavior where
  extensions are enabled at runtime by the entrypoint (imagick excepted).
- Install Xdebug 3.6.0alpha1 on PHP 8.6 via PIE instead of building
  from a source tarball.
- Pin imagick to 3.8.1, and add `libtool`, which PIE expects.

PHP 7.4 and 8.0 continue to use PECL, as PIE requires PHP 8.1+ to run,
and Xdebug 3.1.x (the last version supporting PHP 7.4) is not published
for PIE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gwJZGdkh78pggUy4zs
The latest tagged releases (Imagick 3.8.1, Memcached 3.4.0) do not
compile against PHP 8.6, which removed the `XtOffsetOf` and `zval_dtor`
compatibility macros. Both extensions build on their default branches,
so they are pinned to specific commits until tagged releases with PHP
8.6 support are available.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gwJZGdkh78pggUy4zs
Reverts ce55538. Images should only install released versions of
extensions. Imagick and Memcached can be added to the PHP 8.6 image once
tagged releases with PHP 8.6 support are published.

Building Imagick from an unreleased commit also leaves its version
string as `dev-master`, which fails WordPress' minimum version check in
`WP_Image_Editor_Imagick::test()`, so WordPress falls back to GD.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gwJZGdkh78pggUy4zs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gwJZGdkh78pggUy4zs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the migration to PIE-based extension installation.

No open issues 🎉

What changed in this PR

Migrates extension installation to PIE for the WordPress development images using PHP 8.1+, while retaining PECL for PHP 7.4 and 8.0.

Changes:

  • Updates the generator to bind-mount pinned PIE during builds and adds libtool for PHP 8.1–8.6.
  • Uses pinned PIE packages for PHP 8.1–8.5, preserving default Imagick enablement and runtime toggles for other extensions.
  • Adds PIE-based Xdebug installation for PHP 8.6; older images receive only a comment change.
File Description
update.php Adds PIE configuration and installation generation alongside legacy PECL support.
images/​8.6/​php/​Dockerfile Installs Xdebug 3.6.0alpha1 through PIE.
images/​8.5/​php/​Dockerfile Migrates four extensions to pinned PIE packages.
images/​8.4/​php/​Dockerfile Migrates four extensions to pinned PIE packages.
images/​8.3/​php/​Dockerfile Migrates four extensions to pinned PIE packages.
images/​8.2/​php/​Dockerfile Migrates four extensions to pinned PIE packages.
images/​8.1/​php/​Dockerfile Migrates four extensions to pinned PIE packages.
images/​8.0/​php/​Dockerfile Rewords the installation comment; behavior is unchanged.
images/​7.4/​php/​Dockerfile Rewords the installation comment; behavior is unchanged.

Review effort: Balanced

@desrosj desrosj self-assigned this Nov 4, 2026
@desrosj
desrosj marked this pull request as ready for review November 4, 2026 21:18
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: desrosj <desrosj@git.wordpress.org>
Co-authored-by: lancewillett <lancewillett@git.wordpress.org>
Co-authored-by: lucatume <lucatume@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@desrosj desrosj moved this from Backlog to In progress in WordPress Project Build Tooling Nov 4, 2026
@desrosj desrosj moved this from In progress to Ready in WordPress Project Build Tooling Nov 4, 2026
@desrosj desrosj moved this from Ready to In review in WordPress Project Build Tooling Nov 4, 2026
@desrosj
desrosj requested review from a team, johnbillion, lancewillett and lucatume November 4, 2026 21:20

@lancewillett lancewillett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. The update.php output matches the committed Dockerfiles, and the uncommitted-changes check confirms it. In the 31ce4ec build logs, all four extensions install on 8.1–8.5 at the versions trunk's PECL build used. That includes Imagick, which already resolved to 3.8.1, so the pin changes nothing today. Imagick still loads by default, and the rest stay off until the entrypoint enables them. Memcached's configure defaults match the old PECL answers too: session and SASL on, serializers off.

Two non-blocking notes:

  1. On trunk, the 8.6 image has no Xdebug. So this adds Xdebug rather than replacing a tarball build, as the description and 11656fc say. Worth fixing in the squash message. In core, the PHP 8.6 job's "Run (Xdebug) tests" step will start running under 3.6.0alpha1. That job allows errors, so it can't block, but new results may show up.
  2. Consider pinning the PIE image by digest (ghcr.io/php/pie:1.5.5-bin@sha256:3fca03c16df842d02b654dc382db3756058d9c128064f57cace14f8728779ce9, the digest CI resolved). That matches how this repo pins actions by SHA.

The earlier CLI 8.2 failure was a GHCR unknown blob error during push, unrelated to this change.

AI review · claude-opus-5-5

Pins `ghcr.io/php/pie:1.5.5-bin` by digest, matching how this repository pins actions by SHA.

Removes Xdebug from the PHP 8.6 image. Trunk does not install Xdebug for 8.6, so adding it is a separate change for a later PR. With nothing installed through PIE, the 8.6 image also no longer needs `libtool`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011Y86gwJZGdkh78pggUy4zs
@desrosj

desrosj commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

I've gone and removed the Xdebug addition for PHP 8.6 and will follow up with this in a separate PR.

@desrosj
desrosj enabled auto-merge (squash) November 10, 2026 16:17
@desrosj
desrosj disabled auto-merge November 10, 2026 19:13
@desrosj
desrosj merged commit 09201bc into trunk Nov 10, 2026
20 checks passed
@desrosj
desrosj deleted the use-pie-for-extensions branch November 10, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants