wodby / php

Generic PHP docker container images
MIT License
155 stars 103 forks source link

Fix Blackfire on arm64 platform #168

Closed lexbritvin closed 2 years ago

lexbritvin commented 2 years ago

The image has support for arm64, but Blackfire doesn't work on arm64.

The build for the Blackfire extension uses amd64 and ignores the target platform.

How to reproduce:

$ docker run -it --env PHP_BLACKFIRE=1 wodby/php:7.4 bash
wodby@php.container:/var/www/html $ php -v
[30-Jun-2022 07:32:03 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'blackfire.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so (Error relocating /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so: unsupported relocation type 7), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so.so: No such file or directory)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'blackfire.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so (Error relocating /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so: unsupported relocation type 7), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/blackfire.so.so: No such file or directory)) in Unknown on line 0
PHP 7.4.30 (cli) (built: Jun 10 2022 00:35:32) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies
csandanov commented 2 years ago

Thank you for reporting this and for the PR, there's a TARGETARCH env var from docker buildx, didn't want to bother you to change with such a small modification.