Skip to content

Debugging with XDebug

Koen Teuwen edited this page Feb 12, 2022 · 3 revisions

Setting it up

With Docker

We recommend following the documentation steps of your IDE to set up a debugging environment. The Git repository contains sensible defaults for debugging with PhpStorm.

If you use PhpStorm, all you need to do to start debugging is to enable the 'Start listening for debug connections' feature on the right top of your IDE. If a PHP error occurs inside the container, you will be able to inspect this within the IDE. An easy way to trigger this is by running the PHPUnit tests from within the IDE using the 'Debug'-button. You can also add breakpoints in the code as with most other IDEs.

With your local PHP environment

It is recommended to copy some of the contents from the development php.ini to the php.ini of your local environment (usually located under /etc/php/8.1/cli/php.ini).

Troubleshooting

Firewall

Your firewall may block debug connections coming from the Docker container. If you use UFW, you can allow all connections from Docker containers using sudo ufw allow from 172.0.0.0/8.