With the relatively recent release of xDebug 3 (late November 2020) - there were some major config changes!
Old
My previous go-to configuration for xDebug using the webdevops/php-dev:7.3
image:
.env
file loaded in docker-compose
but would work in docker run
:
PHP_DEBUGGER=xdebug
XDEBUG_REMOTE_AUTOSTART=1
XDEBUG_REMOTE_CONNECT_BACK=0
XDEBUG_REMOTE_HOST=192.168.1.6
XDEBUG_IDE_KEY=phpstorm
XDEBUG_REMOTE_PORT=9000
New
Recently started using version 7.4 and this image uses xDebug 3, which includes some significant changes.
The equivalent .env
file to get the same end result from the previous version is:
PHP_DEBUGGER="xdebug"
XDEBUG_MODE="develop,debug"
XDEBUG_CLIENT_HOST="192.168.1.6"
XDEBUG_CLIENT_PORT="9003"
XDEBUG_IDE_KEY="phpstorm"
XDEBUG_SESSION="phpstorm"
XDEBUG_START_WITH_REQUEST="yes"
That’s pretty much it.
Setting up xDebug in PHPStorm is pretty straightforward. I have an old article on that (planning on updating it).
Configuring in PHPStorm
Configure debug settings.
Add a server with path maps.
Add a run configuration.