docker-php-extension-installer icon indicating copy to clipboard operation
docker-php-extension-installer copied to clipboard

Switch to PIE

Open cooperotto opened this issue 6 months ago • 21 comments

Recently there was an issue with the PECL package server. https://github.com/mlocati/docker-php-extension-installer/issues/1124

The maintainer of PECL suggested moving to the alternative called PIE https://github.com/php/web-pecl/issues/105#issuecomment-3004799395

Would it be possible to make the switch? https://github.com/php/pie

cooperotto avatar Jun 25 '25 13:06 cooperotto

Pie requires PHP 8.1, whereas install-php-extensions supports much older PHP versions (and no, I'm not going to drop support for them).

Maybe we could use pie for PHP 8.1+ and pecl for older versions, but that would require a lot of work, making the script even more complex.

mlocati avatar Jun 25 '25 14:06 mlocati

PIE runs on PHP 8.1 and later only, but it can install extensions for older PHP versions.

derickr avatar Jun 26 '25 08:06 derickr

PIE runs on PHP 8.1 and later only, but it can install extensions for older PHP versions.

In docker images there is usually only one version of PHP installed.

mlocati avatar Jun 26 '25 11:06 mlocati

Maybe we could use pie for PHP 8.1+ and pecl for older versions, but that would require a lot of work, making the script even more complex.

Perhaps a note on the README indicating that only PECL and Pickle are supported and there are currently no plans to support PIE then? PHP itself is pushing PIE a fair bit (there's now a banner suggesting to use it on the PECL homepage), so I imagine this ask is going to come up more frequently in the future.

If the maintenance burden for all 3 platforms is too much, considering Pickle is abandoned, removing support for that might help going forward.

mbabker avatar Aug 13 '25 14:08 mbabker

PECL at some point, is going to go away, with PIE being the replacement. You might not want to do anything about this now, but you will have to in the future.

derickr avatar Aug 13 '25 16:08 derickr

In my opinion it seems beneficial to align the project's support with PHP's official End-of-Life schedule and establish PHP 8.1 as the minimum version.

PHP 8.0 has been EOL since November 2023, and its final release was over two years ago. Continuing to support it adds complexity and prevents the use of modern tools like pie.

Users who are required to stay on unsupported PHP versions can continue to use an older, stable release of this installer.

Skaronator avatar Sep 24 '25 09:09 Skaronator

PIE is too big

shinsenter avatar Sep 28 '25 14:09 shinsenter

I'm very interested to hear what others are thinking on this. From what I understand, this is what I am seeing:

Pros of PIE

  • It's clearly the future, especially with PECL even posting a deprecation warning on the homepage linking to PIE
  • It seems to have more specific control of which versions to install because it uses packagist

Cons of PIE

  • It seems to add a lot of bloat (README calls for sudo apt install gcc make autoconf libtool bison re2c pkg-config php-dev to be run)
  • It doesn't support older versions of PHP (I totally see both sides of "Well, PHP 7.4 is no longer supported" and "There are enterprises working to upgrade from PHP 7.4")

I really love Michele's work on install-php-extensions. It's very simple to install and it doesn't leave bloat behind. It also was designed from the perspective of a "containerized first" approach (keeping all these best practices of container design in mind).

But I also see that PECL could turn the servers off at anytime now they have the deprecation warning.

Does anyone know if PIE is going to improve their design for containers? Or will we still need some sort of wrapper script like install-php-extensions that will install the build dependencies then clean up after itself?

jaydrogers avatar Oct 02 '25 14:10 jaydrogers

Cons of PIE

* It doesn't support older versions of PHP

This is the major problem of pie IMHO.

PS: In my (little) spare time I'm working on a brand new version of install-php-extensions. Its new features will be:

  • written in PHP (compatible with PHP from 5.5 to the latest)
  • installable as a composer dependency (so that tools like PIE will be able to use it to install the system dependencies of PHP extensions)
  • distributed as a PHAR (so that you'll still be able to download and execute it as you do today)

mlocati avatar Oct 02 '25 15:10 mlocati

I may be missing something, but isn't the goal of pie to replace docker-php-extension-installer? Once pie is fully ready and battle-tested for all extensions, would there still be a reason to use docker-php-extension-installer?

(apart from being lighter and supporting older PHP versions, which can certainly be advantages)

pereorga avatar Oct 27 '25 15:10 pereorga

Yep, they will overlap. But pie requires PHP 8.1 and I want a tool that works with older PHP versions, and I don't want to maintain 2 different projects.

mlocati avatar Oct 27 '25 15:10 mlocati

But pie requires PHP 8.1 and I want a tool that works with older PHP versions, and I don't want to maintain 2 different projects.

Downgrading using Rector might be an option. Big projects like PHPStan use Rector to support >= PHP 7.4 even if the code and the libs are written with newer PHP features.

mvorisek avatar Nov 24 '25 10:11 mvorisek

It's not possibile to "downgrade" the minimum supported PHP version of PIE, since it relies on a ton of dependencies that require PHP 8.1+. Furthermore, install-php-extensions does many different things compared to PIE.

mlocati avatar Nov 24 '25 11:11 mlocati

Yep, they will overlap. But pie requires PHP 8.1 and I want a tool that works with older PHP versions, and I don't want to maintain 2 different projects.

Thank you for supporting older version. The reason why our company isnt yet switched to PIE..

a-h-abid avatar Nov 24 '25 11:11 a-h-abid

Yes, there are a lot of people out there who want to force you to do things their way ("my way is the only way to do things right: you have to do it my way").

I'm more of a "what can I do for you" type of person.

For example, I love the Composer authors: they support truly historic PHP versions (see, for example, https://github.com/composer/composer/blob/2.2/composer.json#L25).

This is how tools that can be used across the most diverse projects should be.

mlocati avatar Nov 24 '25 11:11 mlocati

Quick update folks, I've been in touch with @mlocati to discuss what we can do to get PIE closer to being usable in mlocati/docker-php-extension-installer, and we've at least got parts of the roadmap coming up that should improve the situation :)

asgrim avatar Nov 28 '25 15:11 asgrim

I may be wrong but even if it's temporally weird, isn't docker-php-extension-installer the PIE for older PHP versions?

I feel like it's responsibility of:

  • Docker's PHP images maintainers to ship newer versions with PIE, because it's easy,
  • Older versions with docker-php-extension-installer, because it's easy AND compatible?

I love docker-php-extension-installer but is it really its fight? I don't speak about "making PIE evolving to be as simple as docker-php-extension-installer" that is neat, but about "make docker-php-extension-installer using PIE in internal"? Just my 0,02€

Nayte91 avatar Dec 04 '25 11:12 Nayte91

At the moment, PIE can't install all the system libraries required by PHP extensions. There are plans to do that, btw

mlocati avatar Dec 04 '25 11:12 mlocati

Yep, absolute; we're working on bits to do with system deps/build tools etc on PIE side; but that said, I still think there is a place for docker-php-extension-installer; to wrap PIE up and ensure the best practices Docker approach is followed (where PIE is a general non-Docker specific tool, it may not necessarily do things in the Docker best-practice way, if that makes sense).

asgrim avatar Dec 04 '25 11:12 asgrim

@asgrim did you considered supporting at least PHP 7.4? - the code changes will be minimal and it will allow PIE to be used for more projects. For example for atk4 project I maintain we want to keep historical support as much as possible. To do so, we need all tooling to support the historical versions of PHP.

mvorisek avatar Dec 04 '25 11:12 mvorisek

@asgrim did you considered supporting at least PHP 7.4?

No - PHP 7.4 has been out of security support for three years, it made very little sense to bake in support for such an old version for a brand new project. That said, we are working on a self-contained executable release of PIE (alongside the PHAR), which will work even without PHP installed (although, understandably it wouldn't be able to install extensions on anything 😆). See php/pie#443 - this will essentially mean if the executable works, the PHP version you have is irrelevant.

asgrim avatar Dec 04 '25 11:12 asgrim