Using webdevops/php-dev:7.x and configuring xDebug 3 for local development in PHPStorm

Tag
Published:
Author: Ally

Table of Contents

  1. Old
  2. New
  3. Configuring in PHPStorm

make rule for local dev with xdebug

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.

languages and frameworks -> php -> debug

Add a server with path maps.

languages and frameworks -> php -> servers

Add a run configuration.

add remote debug run configuration

A backend implementation for livewire/sortable
Using Terraform to provision & configure infrastructure - AWS S3 website bucket hosting & Cloudflare DNS updates
To bottom
To top
< SM
max-width: 640px