Enable the Xdebug extension:
PHP_EXTENSION_XDEBUG=1The image then configures Xdebug to connect back to your Docker host:
xdebug.modeis set todebug- on Linux,
xdebug.client_hostis the IP of your Docker gateway - on Windows and macOS,
xdebug.client_hostis the IP ofhost.docker.internal(ordocker.for.mac.localhoston old Docker versions)
To debug from inside the container (for instance with VSCode devcontainers),
set xdebug.client_host yourself with the XDEBUG_CLIENT_HOST variable:
XDEBUG_CLIENT_HOST=127.0.0.1The other Xdebug parameters can be set like any php.ini parameter (see PHP configuration),
e.g. PHP_INI_XDEBUG__START_WITH_REQUEST=yes.
The fat images come with the Blackfire PHP probe and CLI. Enable the probe with:
PHP_EXTENSION_BLACKFIRE=1The probe expects the Blackfire agent to run in another container, reachable with the blackfire host name:
services:
php:
image: thecodingmachine/php:8.4-v5-apache
ports:
- "80:80"
environment:
PHP_EXTENSION_BLACKFIRE: 1
blackfire:
image: blackfire/blackfire
environment:
# Exposes the BLACKFIRE_SERVER_ID and BLACKFIRE_SERVER_TOKEN environment variables of the host
- BLACKFIRE_SERVER_ID
- BLACKFIRE_SERVER_TOKENIf the agent has another host name, set it with the BLACKFIRE_AGENT variable:
services:
php:
image: thecodingmachine/php:8.4-v5-apache
environment:
PHP_EXTENSION_BLACKFIRE: 1
BLACKFIRE_AGENT: myblackfire
myblackfire:
image: blackfire/blackfire
# ...See the Blackfire Docker documentation for more information.
With a slim image, add blackfire to the PHP_EXTENSIONS ARG.
The probe version 2 is installed by default; the BLACKFIRE_VERSION=1 build ARG installs the version 1, which has
known security issues.