Video Lesson: Configure PhpStorm for Xdebug connections in Docker

Configure PhpStorm for Xdebug connections in Docker

Learn how to configure an IDE to receive and debug remote connections from containerized applications.


Lesson Content

Once the Xdebug browser plugin is installed and enabled, enable debug mode with:

bin/xdebug enable

Now configure PhpStorm to listen for Xdebug connections. Open PhpStorm -> Preferences, select PHP -> Debug, and verify that the Xdebug port is set to 9000,9003.

Xdebug 3 uses port 9003 by default, while older versions use port 9000. Keeping both ports allows PhpStorm to accept connections from either version. Click OK after verifying the ports.

Next, open Run -> Edit Configurations and add a new configuration of type PHP Remote Debug. Name the configuration magento.test.

Select Filter debug connection by IDE key. Since no server is configured yet, click the three-dot button next to Server, then click the plus button to add one.

Set the server name and host to magento.test. Keep the port set to 80, and make sure the debugger is set to Xdebug.

Select Use path mappings. This maps the project directory on your local machine to the project directory inside the Docker container. Map the local src directory to /var/www/html:

Local path Remote path
src /var/www/html

Both paths point to the root of the Magento project. Click OK to save the server configuration.

Back in the remote debug configuration, set the IDE key to PHPSTORM. This value must match the IDE key configured in the Xdebug browser plugin.

Click OK to save the configuration. PhpStorm is now ready to listen for Xdebug connections.

Maggie

Hey, I'm Maggie! 👋

Ask me anything.

Want to chat with Maggie?

Log in for AI tutor access.

Comments

Join the discussion!

Notes

Keep track of what you learn!