Developer tool
Docker PHP + Xdebug Generator
Generate Dockerfile, xdebug.ini, and Compose fragments for PHP with Xdebug 3.
How it works
What it does
This generator creates text fragments for a PHP Docker setup with Xdebug 3: Dockerfile pieces, an xdebug.ini, and a Compose-oriented snippet. Supported PHP versions are constrained to known current 8.x lines offered by the form.
When to use it
- Bootstrap a local debugging container quickly
- Standardize team onboarding docs with a known-good baseline
- Compare host.docker.internal vs Linux gateway approaches
How input is processed safely
Only version/mode fields are required. The tool does not build images on this server, does not pull Docker Hub layers, and does not start containers. You copy the text into your own repository and build locally.
Examples
- PHP 8.3 image with pecl xdebug and mode=debug
- Compose environment variables for IDE host
- Volume-mounted source for breakpoint path mapping
Common mistakes
- Baking Xdebug into production images
- Forgetting to expose/publish nothing extra while still allowing IDE connect paths
- Hard-coding secrets into Dockerfile
ENVlines
Containers add path mapping and networking complexity to debugging. Generated fragments give you a known baseline: install Xdebug, set mode, and point client_host at the IDE. You still customize base images, extensions, and users for your project.
Keep production images free of Xdebug. Use multi-stage builds or separate Docker targets (dev vs prod) so debug tooling cannot ship accidentally. Pin versions thoughtfully so teammates reproduce the same behavior.
After generation, verify breakpoints with a trivial script before debugging a full framework bootstrap. That isolates IDE mapping issues from application autoload issues.
Practical tips
- Keep inputs small and representative; huge pastes slow feedback and raise risk of accidental secret disclosure.
- After using Docker PHP + Xdebug Generator, verify the result in your own environment (correct SAPI, correct host, correct project root).
- Cross-link findings to ZendStudio.net PHP error guides and IDE setup pages when the next step is configuration rather than code edits.
- Prefer repeatable project tooling (CI, Composer scripts, IDE inspections) for repo-wide enforcement; this page is for interactive problem-solving.
Privacy note
Keep real registry credentials out of generated samples. Use Docker BuildKit secrets or runtime env files ignored by git.
Run in browser
AJAX processing only. No remote PHP execution sandbox. Results are not indexed.
Safety notes
- Submitted tool contents are not written to analytics or search logs.
- This site never evaluates arbitrary PHP from the browser.
- Generated configs are starting points—validate on a staging host before production.