From 97dacf850726d30ac51e480308f03636d8818deb Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Thu, 2 Jan 2025 16:39:43 +0100 Subject: [PATCH 1/3] Add PIE as method for installing PHP extensions --- php/content.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/php/content.md b/php/content.md index f53d27d4f293..dbc8aa908603 100644 --- a/php/content.md +++ b/php/content.md @@ -71,6 +71,19 @@ See also ["Dockerizing Compiled Software"](https://tianon.xyz/post/2017/12/26/do Some extensions are compiled by default. This depends on the PHP version you are using. Run `php -m` in the container to get a list for your specific version. +### PIE extensions + +The latest recommended way of installing PHP extensions is through [PIE](https://github.com/php/pie). To install a PIE-compatible extension, use `pie install` to download, compile and enable it. + +```dockerfile +FROM %%IMAGE%%:8.2-cli + +# Install PIE here (see https://github.com/php/pie/blob/main/docs/usage.md) + +RUN pie install phpredis/phpredis:^6.1 \ + && pie install xdebug/xdebug:^3.4 +``` + ### PECL extensions Some extensions are not provided with the PHP source, but are instead available through [PECL](https://pecl.php.net/). To install a PECL extension, use `pecl install` to download and compile it, then use `docker-php-ext-enable` to enable it: From 33b08e7e488b8ae4deb3d779d6d6f048de5019e5 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Thu, 2 Jan 2025 16:42:31 +0100 Subject: [PATCH 2/3] Add deprecation notice to PHP PECL extensions documentation --- php/content.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php/content.md b/php/content.md index dbc8aa908603..02dd2241c619 100644 --- a/php/content.md +++ b/php/content.md @@ -86,6 +86,8 @@ RUN pie install phpredis/phpredis:^6.1 \ ### PECL extensions +⚠️ Note: Installation of PEAR and thus also PECL with PHP is deprecated and thus subject to removal in a future PHP version. See also https://github.com/php/php-src/commit/e93d6d97aab7a5de1f7b8dc750ca9d08214de8c4. + Some extensions are not provided with the PHP source, but are instead available through [PECL](https://pecl.php.net/). To install a PECL extension, use `pecl install` to download and compile it, then use `docker-php-ext-enable` to enable it: ```dockerfile From 9bfe5ed45ecda127ae029a3c48b52777f0317f51 Mon Sep 17 00:00:00 2001 From: Jesper Noordsij Date: Mon, 13 Jan 2025 14:38:32 +0100 Subject: [PATCH 3/3] Update installation example based on feeback from @asgrim and @TimWolla --- php/content.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/php/content.md b/php/content.md index 02dd2241c619..4f7bb241e882 100644 --- a/php/content.md +++ b/php/content.md @@ -78,8 +78,14 @@ The latest recommended way of installing PHP extensions is through [PIE](https:/ ```dockerfile FROM %%IMAGE%%:8.2-cli -# Install PIE here (see https://github.com/php/pie/blob/main/docs/usage.md) - +# Install PIE here; e.g. through using Docker +RUN export DEBIAN_FRONTEND="noninteractive"; \ + set -eux; \ + apt-get update; apt-get install -y --no-install-recommends unzip; \ + rm -rf /var/lib/apt/lists/* +COPY --from=ghcr.io/php/pie:bin /pie /usr/bin/pie + +# Use PIE to install extensions RUN pie install phpredis/phpredis:^6.1 \ && pie install xdebug/xdebug:^3.4 ```