Switch to PIE
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
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.
PIE runs on PHP 8.1 and later only, but it can install extensions for older PHP versions.
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.
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.
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.
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.
PIE is too big
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-devto 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?
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)
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)
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.
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.
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.
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..
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.
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 :)
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€
At the moment, PIE can't install all the system libraries required by PHP extensions. There are plans to do that, btw
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 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.
@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.