3 Debugging
Danny edited this page 2025-04-24 13:49:00 +01:00

Debugging with Xdebug

Loom Spinner PHP environments include Xdebug by default, making it easy to set up step debugging in your preferred IDE.

Disabling Xdebug

To disable Xdebug for a new environment:

  • Pass the --disable-xdebug option to spin:up
  • Or set
  options:
    environment:
      php:
        xdebug: false

in your project's before building the environment spinner.yaml

Changes require destroying/rebuilding your environment (see Configuration). Note:

Configuring Your IDE for Debugging

The following instructions use PhpStorm, but similar settings apply in other IDEs.

1. Configure PHP Server

  1. Go to: File > Settings > PHP > Servers
  2. Add a new server:
    • Name: (any, e.g. Loom Spinner)
    • Host: 127.0.0.1
    • Port: Use the local port your PHP container exposes (e.g., if 52033:9003 appears in docker ps, use 52033)
    • Debugger: Xdebug
    • Use path mappings: (Enabled)
      • Map your project root to /var/www/html
Setting Value
Host 127.0.0.1
Port Local port PHP container is running on. i.e. if your docker container shows 52033:9003, use 52033.
Debugger Xdebug
Use path mappings?
File/Directory Select your project root
Absolute path on server /var/www/html

2. Set Up Remote Debugging

  1. Go to: Run > Edit Configurations
  2. Add New Configuration:
    • Select PHP Remote Debug
    • Assign a name (e.g., Debug with Loom)
    • Choose the server you just created
    • Set IDE key: SPINNER

3. Start Listening for Debug Connections

  • Click the debug (bug) icon in your IDE to start listening for incoming debug connections.
  • Set breakpoints in your code as needed.

Notes

  • The IDE key must be set to SPINNER for remote debugging.
  • The local port used by the PHP container can be found via docker ps.
  • Make sure Docker is running and your environment is active.

For detailed tips, troubleshooting, or more advanced setup, consult your IDE's Xdebug documentation.