To use xdebug with macOS and docker is quite, let´s call it tricky ;)
The following steps need to be proceed to get it working:
- use the config from the xdebug.ini wihtin your docker web container. Important: set remote_connect_back to off
- set up an alias for your local interface (lo)
To bring up the alias at startup, you can either (sudo may be needed here):
-
manually place the file
com.manuelselbach.docker_10254254254_alias.plist
into directory:/Library/LaunchDaemons/
-
Or use the script
set_and_install_autorun_alias_for_lo.sh
After all that, just configure your PhpStorm:
- set port for xdebug
Preferences -> Languages & Frameworks -> PHP -> Debug | Xdebug: Debug port = 9005
- configure a configuration in the toolbar
- use PHP remote Debug
- add a server to your domain (without protocoll like http:// or https://)
- set port for http / https (not the xdebug port here)
- select Debugger: Xdebug
- if needed: set path mappings
- set Ide key (session id): to PHPSTORM
Happy debugging with docker!