mlocati / docker-php-extension-installer

Easily install PHP extensions in Docker containers
MIT License
4.18k stars 378 forks source link

Fix SourceGuardian 15 installation on Alpine Linux #912

Closed justusbunsi closed 4 months ago

justusbunsi commented 4 months ago

SourceGuardian loader 15 now relies on libudev.

Error message ```text ### INSTALLING REMOTE MODULE sourceguardian ### Downloading SourceGuardian... done (version: 15.0.0) Removing symbols from /usr/local/lib/php/extensions/no-debug-zts-20220829/sourceguardian.so... done (16776 bytes saved). Check if the sourceguardian module can be loaded... Error loading the "sourceguardian" extension: Warning: Failed loading Zend extension 'sourceguardian.so' (tried: /usr/local/lib/php/extensions/no-debug-zts-20220829/sourceguardian.so (Error loading shared library libudev.so.1: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-zts-20220829/sourceguardian.so)), /usr/local/lib/php/extensions/no-debug-zts-20220829/sourceguardian.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-zts-20220829/sourceguardian.so.so: No such file or directory)) in Unknown on line 0 ```

Recreation steps:

docker run --rm -it --entrypoint=/bin/sh dunglas/frankenphp:latest-php8.2-alpine
# in container
install-php-extensions sourceguardian
  # results in above error message

Showcase of the fix:

docker run --rm -it --entrypoint=/bin/sh dunglas/frankenphp:latest-php8.2-alpine
# in container
curl -sSLf -o /usr/local/bin/install-php-extensions https://raw.githubusercontent.com/justusbunsi/docker-php-extension-installer/sourceguardian15-alpine/install-php-extensions
chmod +x /usr/local/bin/install-php-extensions
install-php-extensions sourceguardian
php -m
  # [Zend Modules]
  # SourceGuardian

Debian-based images seem fine.

mlocati commented 4 months ago

It seems that the smallest APT package providing libudev.so.1 is eudev-libs (usually -dev packages are used only in the compile phase).

Also, can you add a commit message containing Test: sourceguardian (as explained in the README).

justusbunsi commented 4 months ago

Thank you for your fast review. My bad missing the instructions in the README - thanks for the hint. Will update the PR later/tomorrow.

justusbunsi commented 4 months ago

Switched to eudev-libs and added the test marker to the commit. SourceGuardian loader still works with that smaller library. I've tested it on an internal application running in an Alpine container.