How to configure Xdebug when using Docker and amazee.io.
- PhpStorm
- Xdebug module is properly loaded (See Amazee.io documentation)
- Xdebug helper plugin for your favorite browser.
- Chrome extension "Xdebug helper" is used in this example.
-
Open your project in PhpStorm and enable "Break at first line in PHP scripts"
-
Enable listening for PHP Debug Connections. Can also be enabled from `Run -> Start Listening for PHP Debug Connections
-
Open your browser and enable your favorite Xdebug helper tool. Make sure your helper tool IDE key is PHPSTORM
-
Open or refresh your website in the browser and wait for PhpStorm to wake up. Sometimes you might need to open PhpStorm manually. 4.1. Select: Manually choose local file or project 4.2. Select: builds/devbuild/index.php
-
Let PhpStorm to resume the program by clicking the green play button. You might need to click it multiple times.
-
Disable "Break at first line in PHP scripts". See image in part 1.
-
Navigate to your custom code in code-folder and add
xdebug_break();
to some module/function which you know will be loaded. See image at 8. Adding a normal PhpStorm breakpoint might not work before the path mappings are set. -
Refresh your browser and wait for PhpStorm to wake up. Again, you might need to open PhpStorm manually. 8.1. Click: Click to set up path mappings
-
PhpStorm will open a dialog where you can set the correct path for your custom file. Instead of finding the file from the directory tree, look for code -folder and set the correct absolute path for the code folder. See image below.
-
Remove
xdebug_break();
and replace it with PhpStorm breakpoint. Refresh the browser and enjoy debugging, because you're done!