Enable, disable, and check the status of Xdebug in Docker
Learn how to control and check a debugging tool's active mode to balance debugging capabilities with application performance.
Lesson Content
To debug with Xdebug, the Xdebug PHP extension must be installed and enabled on the web server. docker-magento installs and enables the extension automatically.
Since Xdebug 3, the extension remains enabled inside the container, but its mode is set to off by default. Keeping the extension installed and enabled has no performance impact. The performance impact comes from setting the Xdebug mode to debug, so you only enable that mode while actively debugging.
To check the current Xdebug status, run:
bin/xdebug statusThe output shows whether debug mode is enabled. To enable debug mode, run:
bin/xdebug enableThis enables Xdebug in the container and restarts the container automatically. Check the status again to confirm that debug mode is enabled:
bin/xdebug statusWhen you finish debugging, disable debug mode again:
bin/xdebug disableThis sets the Xdebug mode back to off. Check the status whenever you need to confirm the current mode:
bin/xdebug statusKeep Xdebug off during normal development and enable it only when you are actively debugging with Xdebug.
Join the discussion!
Comments
Want to comment on this lesson?
Log in to leave comments.