XDebug 3 only started working out of the box with PhpStorm version 2020.3
Reference article - Configure Xdebug
The list of changes from XDebug 2 to 3 are available here for reference - Upgrade Guide
Go to PhpStorm -> Settings -> Languages & Frameworks -> PHP -> Servers
- Click "+"
- Name
ddebug
(Same as serverName under PHP_IDE_CONFIG environment variable) - Host
_
- Default 80
- Debugger Xdebug
- Check the checkbox next to "Use path mappings"
- Modify the absolute path on the server to
/var/www/html
- Add breakpoints file
- In PhpStorm click the icon to "Start Listening for PHP Debug connections"
- Run in the docker file:
docker exec debug php index.php
- Run without nginx:
SCRIPT_NAME=/index.php \
SCRIPT_FILENAME=/var/www/html/index.php \
REQUEST_METHOD=GET \
cgi-fcgi -bind -connect 127.0.0.1:9035
# Install cgi-fcgi:
sudo apt update && sudo apt install libfcgi0ldbl
- Check firewall or selinux if on linux
- The configuration
host.docker.internal
only became available under Mac and Windows with Docker version20.04
Add to docker-compose follow lines:
extra_hosts:
- "host.docker.internal:host-gateway"
Change attrs:
mkdir -p /tmp/xdebug
chmod -R 777 /tmp/xdebug