joseluisq / alpine-php-fpm

Lightweight & optimized Multi-Arch Docker Images (x86_64/arm/arm64) for PHP-FPM (PHP 8.1, 8.2, 8.3) with essential extensions on top of latest Alpine Linux. :elephant:
Apache License 2.0
175 stars 40 forks source link

PSR conflict with Symfony #40

Open pvdleek opened 1 week ago

pvdleek commented 1 week ago

Hi, I ran into an issue today that the PSR extension conflicts with the Symfony cache component. I therefore had to remove PSR, but as there is no "docker-php-ext-disable" (and it will not be there, see https://github.com/docker-library/php/issues/220#issuecomment-353677238) I tried "pecl uninstall psr". Unfortunately that created another issue:

PHP Warning:  PHP Startup: Unable to load dynamic library 'psr' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20230831/psr (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20230831/psr: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20230831/psr.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20230831/psr.so: No such file or directory)) in Unknown on line 0

I could of course create a PR for the removal of PSR, but it might be more interesting to have a ENV variable control the installation of PSR (and maybe other extensions).

How do you feel about this?

joseluisq commented 6 days ago

It sounds not bad. I'm thinking of something like an ENV to pass a list of extensions (not just PSR) to disable at start-up (remove them eventually).

joseluisq commented 6 days ago

On the other hand, being able to turn off extensions at build time should be also a nice feature since not all users want the same amount of extensions to use.

joseluisq commented 6 days ago

Feel free to propose something in either case.

pvdleek commented 6 days ago

I think an ENV would do just fine. At this point I would go for a blacklist to disable certain extensions. So in my case I would pass on an ENV "EXTENSION_BLACKLIST" with value "psr" or something like that. In the mean time I made a copy of this repo, removed PSR and published my own base-image, but I'd rather go back to this repo with the possibility to disable PSR ;)