Skip to content

Instantly share code, notes, and snippets.

@janklan
Created May 15, 2025 23:08
Show Gist options
  • Save janklan/e212cde6c70e82dfd751264e1c6c5315 to your computer and use it in GitHub Desktop.
Save janklan/e212cde6c70e82dfd751264e1c6c5315 to your computer and use it in GitHub Desktop.
Blackfire FrankenPHP debug
#0 building with "desktop-linux" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 15.16kB done
#1 DONE 0.0s
#2 [auth] dunglas/frankenphp:pull token for registry-1.docker.io
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/dunglas/frankenphp:php8.3.7-bookworm
#3 DONE 1.6s
#4 [internal] load .dockerignore
#4 transferring context: 720B done
#4 DONE 0.0s
#5 [blackfire_debug 1/10] FROM docker.io/dunglas/frankenphp:php8.3.7-bookworm@sha256:8bee13635f4c136b6e222e7e120a4e54a83caad8dd906ccab3b3d1ba4abdaef3
#5 CACHED
#6 [blackfire_debug 2/10] RUN curl https://packages.blackfire.io/gpg.key > /usr/share/keyrings/blackfire-archive-keyring.asc && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/blackfire-archive-keyring.asc] http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list && apt update && apt install blackfire
#6 0.104 % Total % Received % Xferd Average Speed Time Time Time Current
#6 0.104 Dload Upload Total Spent Left Speed
100 3949 100 3949 0 0 5058 0 --:--:-- --:--:-- --:--:-- 5062
#6 0.892 deb [arch=arm64 signed-by=/usr/share/keyrings/blackfire-archive-keyring.asc] http://packages.blackfire.io/debian any main
#6 0.896
#6 0.896 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#6 0.896
#6 0.973 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
#6 1.011 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
#6 1.028 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#6 1.047 Get:4 http://deb.debian.org/debian bookworm/main arm64 Packages [8692 kB]
#6 1.222 Get:5 http://deb.debian.org/debian bookworm-updates/main arm64 Packages [512 B]
#6 1.222 Get:6 http://deb.debian.org/debian-security bookworm-security/main arm64 Packages [254 kB]
#6 2.132 Get:7 http://packages.blackfire.io/debian any InRelease [29.2 kB]
#6 3.686 Get:8 http://packages.blackfire.io/debian any/main arm64 Packages [31.1 kB]
#6 3.950 Fetched 9262 kB in 3s (3052 kB/s)
#6 3.950 Reading package lists...
#6 4.171 Building dependency tree...
#6 4.222 Reading state information...
#6 4.227 37 packages can be upgraded. Run 'apt list --upgradable' to see them.
#6 4.230
#6 4.230 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#6 4.230
#6 4.239 Reading package lists...
#6 4.452 Building dependency tree...
#6 4.514 Reading state information...
#6 4.584 The following NEW packages will be installed:
#6 4.584 blackfire
#6 5.685 0 upgraded, 1 newly installed, 0 to remove and 37 not upgraded.
#6 5.685 Need to get 9686 kB of archives.
#6 5.685 After this operation, 28.6 MB of additional disk space will be used.
#6 5.685 Get:1 http://packages.blackfire.io/debian any/main arm64 blackfire arm64 2:2.28.24 [9686 kB]
#6 8.078 debconf: delaying package configuration, since apt-utils is not installed
#6 8.088 Fetched 9686 kB in 3s (2831 kB/s)
#6 8.098 Selecting previously unselected package blackfire.
(Reading database ... 13315 files and directories currently installed.)
#6 8.103 Preparing to unpack .../blackfire_2%3a2.28.24_arm64.deb ...
#6 8.105 Unpacking blackfire (2:2.28.24) ...
#6 8.220 Setting up blackfire (2:2.28.24) ...
#6 8.224 creating blackfire system user
#6 8.249
#6 8.249
#6 8.249 ADDITIONAL STEP REQUIRED!
#6 8.249
#6 8.249 If this is a new install please run:
#6 8.249
#6 8.249 sudo blackfire agent:config
#6 8.250 sudo service blackfire-agent start
#6 8.250
#6 DONE 8.3s
#7 [blackfire_debug 3/10] RUN mkdir -p /var/run/blackfire && chown root:www-data /var/run/blackfire && chmod 0770 /var/run/blackfire
#7 DONE 0.1s
#8 [blackfire_debug 4/10] RUN mkdir -p /usr/local/etc/php/custom.d
#8 DONE 0.1s
#9 [blackfire_debug 5/10] RUN echo :/usr/local/etc/php/custom.d
#9 0.116 :/usr/local/etc/php/custom.d
#9 DONE 0.1s
#10 [blackfire_debug 6/10] RUN echo /usr/local/etc/php
#10 0.095 /usr/local/etc/php
#10 DONE 0.1s
#11 [blackfire_debug 7/10] RUN ls -la /usr/local/etc/php
#11 0.130 total 164
#11 0.130 drwxr-xr-x 1 root root 4096 May 15 23:05 .
#11 0.130 drwxr-xr-x 1 root root 4096 May 14 2024 ..
#11 0.130 drwxr-xr-x 1 root root 4096 May 14 2024 conf.d
#11 0.130 drwxr-xr-x 2 root root 4096 May 15 23:05 custom.d
#11 0.130 -rw-r--r-- 1 root root 73251 May 14 2024 php.ini-development
#11 0.130 -rw-r--r-- 1 root root 73397 May 14 2024 php.ini-production
#11 DONE 0.1s
#12 [blackfire_debug 8/10] RUN blackfire php:install -vvv
#12 0.134 Installing for PHP 8.3.7:
#12 0.134 15/05 23:05:33 DBG Client architecure is: arm64
#12 0.134 15/05 23:05:33 DBG Checking PHP version: 8.3.7
#12 0.148 15/05 23:05:33 DBG PHP build is ZTS
#12 0.148 Reading some PHP settings
#12 0.154 15/05 23:05:33 DBG The Blackfire probe will be installed at: /usr/local/lib/php/extensions/no-debug-zts-20230831/blackfire.so
#12 0.154 PHP Extension: /usr/local/lib/php/extensions/no-debug-zts-20230831/blackfire.so
#12 0.154 Creating the "/usr/local/lib/php/extensions/no-debug-zts-20230831/blackfire.so" file
#12 0.158 Looking for a Blackfire probe
#12 0.158 15/05 23:05:33 DBG Downloading Blackfire probe at: https://blackfire.io/api/v1/releases/probe/php/linux/arm64/83-zts.so
#12 0.981 Blackfire Version: 1.92.33
#12 1.836 Downloading Blackfire probe
#12 3.075 Enabling extension
#12 3.090 15/05 23:05:36 DBG Write PHP CLI Configuration at: /usr/local/etc/php/conf.d/99-blackfire.ini
#12 3.093 PHP CLI Configuration: /usr/local/etc/php/conf.d/99-blackfire.ini
#12 3.093 15/05 23:05:36 DBG Write PHP CGI Configuration at: :/usr/local/etc/php/custom.d/99-blackfire.ini
#12 3.093 [ ERR ] Unable to create :/usr/local/etc/php/custom.d/99-blackfire.ini: open :/usr/local/etc/php/custom.d/99-blackfire.ini: no such file or directory
#12 DONE 3.1s
#13 [blackfire_debug 9/10] RUN php -i | grep blackfire
#13 0.105 Additional .ini files parsed => /usr/local/etc/php/conf.d/99-blackfire.ini,
#13 0.105 with blackfire v1.92.33~linux-x64-zts83, https://blackfire.io, by Blackfire
#13 0.105 blackfire
#13 0.105 blackfire.agent_socket => unix:///var/run/blackfire/agent.sock => unix:///var/run/blackfire/agent.sock
#13 0.105 blackfire.apm_agent_timeout_ms => 300 => 300
#13 0.105 blackfire.apm_browser_collector_endpoint => no value => no value
#13 0.105 blackfire.apm_browser_key => no value => no value
#13 0.105 blackfire.apm_browser_pixel_url => no value => no value
#13 0.105 blackfire.apm_browser_probe_url => no value => no value
#13 0.105 blackfire.apm_connect_at_startup => 0 => 0
#13 0.105 blackfire.apm_enable_automatic_browser_probe => 1 => 1
#13 0.105 blackfire.apm_enabled => 1 => 1
#13 0.105 blackfire.apm_lock_duration => 300 => 300
#13 0.105 blackfire.debug.sigsegv_handler => 0 => 0
#13 0.105 blackfire.env_id => no value => no value
#13 0.105 blackfire.env_token => no value => no value
#13 0.105 blackfire.experimental.observer_api => 0 => 0
#13 0.105 blackfire.features.auto_profiling => 1 => 1
#13 0.105 blackfire.features.curl => 1 => 1
#13 0.105 blackfire.features.embedded_code => 1 => 1
#13 0.105 blackfire.hostname => no value => no value
#13 0.105 blackfire.log_file => no value => no value
#13 0.105 blackfire.log_level => 1 => 1
#13 0.105 blackfire.server_id => no value => no value
#13 0.105 blackfire.server_token => no value => no value
#13 0.105 INI settings 'blackfire.server_id' and 'blackfire.server_token' should not be configured manually unless you are using a cloud provider with a shared agent
#13 DONE 0.1s
#14 [blackfire_debug 10/10] RUN php -v
#14 0.128 PHP 8.3.7 (cli) (built: May 14 2024 03:35:46) (ZTS)
#14 0.128 Copyright (c) The PHP Group
#14 0.128 Zend Engine v4.3.7, Copyright (c) Zend Technologies
#14 0.128 with blackfire v1.92.33~linux-x64-zts83, https://blackfire.io, by Blackfire
#14 DONE 0.1s
#15 exporting to image
#15 exporting layers 0.1s done
#15 writing image sha256:048da546b24fa74eaf29e3a453ed5b59c0da0b73bdfcdc106892e0a2d9b5caf2
#15 writing image sha256:048da546b24fa74eaf29e3a453ed5b59c0da0b73bdfcdc106892e0a2d9b5caf2 done
#15 DONE 0.1s
View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/ilbnu3pjkmusl5i3kis2pseob
What's next:
View a summary of image vulnerabilities and recommendations → docker scout quickview
#!/bin/bash
docker build . --target blackfire_debug --no-cache --progress=plain
FROM dunglas/frankenphp:php8.3.7-bookworm AS blackfire_debug
RUN curl https://packages.blackfire.io/gpg.key > /usr/share/keyrings/blackfire-archive-keyring.asc \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/blackfire-archive-keyring.asc] http://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list \
&& apt update \
&& apt install blackfire
# My Caddy/FrankenPHP runs as www-data, so the socket has to be writable by that user
RUN mkdir -p /var/run/blackfire \
&& chown root:www-data /var/run/blackfire \
&& chmod 0770 /var/run/blackfire
# This is in my current Docker image triggering the problem
ENV PHP_INI_SCAN_DIR=":$PHP_INI_DIR/custom.d"
RUN mkdir -p $PHP_INI_DIR/custom.d
# Debug efforts below
RUN echo $PHP_INI_SCAN_DIR
RUN echo $PHP_INI_DIR
RUN ls -la /usr/local/etc/php
RUN blackfire php:install -vvv
RUN php -i | grep blackfire
RUN php -v
@janklan
Copy link
Author

janklan commented May 15, 2025

Confusing lines 110-114 of the log:

#12 3.090 15/05 23:05:36 DBG Write PHP CLI Configuration at: /usr/local/etc/php/conf.d/99-blackfire.ini
                                                                                  ^-- conf.d? That directory doesn't exist and is not configured to be used by PHP
#12 3.093   PHP CLI Configuration: /usr/local/etc/php/conf.d/99-blackfire.ini
#12 3.093 15/05 23:05:36 DBG Write PHP CGI Configuration at: :/usr/local/etc/php/custom.d/99-blackfire.ini 
                                                                                   ^-- correct path
#12 3.093 [ ERR ] Unable to create :/usr/local/etc/php/custom.d/99-blackfire.ini: open :/usr/local/etc/php/custom.d/99-blackfire.ini: no such file or directory
                              ^-- what do you mean "no such file or directory"?. Is it pretending to write to custom.d, but attempting to write to confirm.d? 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment