XDebug 3 only started working out of the box with PhpStorm version 2020.3
Next to 'PHP Interpreter' to bring up the interpreters. Choose 'Docker (SSH)' in the left pane and click on the little folder icon on the bottom of the window next to 'Configuration options'. In the pop up enter xdebug.remotehost as key and host.docker.internal as value and hit 'OK'. 20th January 2021 docker, visual-studio-code, vscode-debugger, xdebug I’m trying to setup xdebug in my development environment and am having some problems.
Reference article - Configure Xdebug
Sony memory card recovery software full version free download for mac. The list of changes from XDebug 2 to 3 are available here for reference - Upgrade Guide
Configuring PhpStorm
Go to PhpStorm -> Settings -> Languages & Frameworks -> PHP -> Servers
- Click '+'
- Name
docker-cli
(Same as serverName under PHP_IDE_CONFIG environment variable) - Host
_
- Default 80
- Debugger Xdebug
- Check the checkbox next to 'Use path mappings'
- Modify the absolute path on the server to
/var/www/html
Running the CLI Command
- Add breakpoints file
- In PhpStorm click the icon to 'Start Listening for PHP Debug connections'
- Run in the docker file -
docker-compose run php-container php test.php
Troubleshooting
- Check firewall or selinux if on linux
- The configuration
host.docker.internal
only became available under Mac and Windows with Docker version20.04
Xdebug is an extension for debugging your PHP code. Magento Cloud Docker provides a separate container to handle Xdebug requests in the Docker environment. Use this container to enable Xdebug and debug PHP code in your Docker environment without affecting your Magento Commerce Cloud project configuration.
The following instructions explain how to configure Xdebug and PhpStorm to debug in your local Docker environment.
If you use Microsoft Windows, take the following steps before continuing:
- Open your Docker settings.
- Select the Expose daemon on tcp://localhost:2375 without TLS checkbox.
- Wait for the settings to apply.
Enable Xdebug
To enable Xdebug for your Docker environment, generate the Docker Compose configuration file in developer mode with the
--with-xdebug
option and any other required options, for example.For Linux systems, you must use the
--set-docker-host
option to add thehost.docker.internal
entry to the/etc/hosts
file for thefpm_xdebug
container.This command adds the Xdebug configuration to your
docker-compose.yml
file.Follow the steps to launch the Docker environment in Developer mode.
The default Docker environment configuration sets the following Xdebug configuration variables:
Change any Xdebug configuration using the
XDEBUG_CONFIG
option. For example, to change the xdebug.remote_port option:On Linux systems, use the following command instead:
To configure PhpStorm to work with Xdebug:
In your PhpStorm project, open the settings panel.
- Mac OS X—Select File > Preferences.
- Windows/Linux—Select File > Settings.
In the Settings panel, expand and locate the Languages & Frameworks > PHP > Servers section.
Click the + to add a
PHP Remote Debug
server configuration. The project name is in grey at the top.Configure the following settings for the new server configuration:
- Name—Enter the name used for the
serverName
option fromPHP_IDE_CONFIG
value. - Host—Enter
localhost
. - Port—Enter
80
. - Debugger—Select
Xdebug
.
- Name—Enter the name used for the
Select Use path mappings. In the File/Directory pane, the root of the project for the
serverName
displays.In the Absolute path on the server column, click and add a value to the
MAGENTO_ROOT
option. The default value is/app
Change the Xdebug port to 9001 in the Languages & Frameworks > PHP > Debug > Xdebug > Debug Port panel.
Click Apply.
Use Xdebug
The following steps describe debugging web requests and CLI commands.
To debug web requests:
In your PhpStorm project, click (Start listening Aperture software download mac. ) in the top navigation bar.
Add breakpoints in the
pub/index.php
file.Install the debug extension in the browser, and then click Debug to enable.
In the browser, open the
https://localhost
URL.When PhpStorm recognizes the Xdebug connection, you can begin debugging web requests.
You can debug any Magento command or PHP script using the following steps.
To debug CLI commands:
In your PhpStorm project, open the Build, Extension, Deployment > Docker panel, and then click
+
to add a new Docker server and update the following settings:- Name—Enter a name for the server, for example
Docker Cloud
. - Connect to Docker daemon with—
- Windows—Select TCP socket and update Engine Api Url with
tcp://localhost:2375
. - Mac OS X—Select Docker for Mac. [default]
- Windows—Select TCP socket and update Engine Api Url with
- Name—Enter a name for the server, for example
In the Languages & Frameworks > PHP > Cli Interpreter panel, click […].
Click [+] to add and configure a new Cli Interpreter from your Docker image. Update the following settings:
- Name—Enter a name for the new interpreter, such as
Magento cloud docker cli
. - Remote—Select
Docker
.- Server—Select
Docker Cloud
from the previous step. - Image name—Select
magento/magento-cloud-docker-php:7.x-cli
.
- Server—Select
- Additional > Debugger extension—
- Windows—Enter
xdebug
. - Mac OS X/Linux—Enter
xdebug.so
.
- Windows—Enter
- Click Refresh to verify that the interpreter and Xdebug extension are configured properly.
- Name—Enter a name for the new interpreter, such as
Click Save. Ion discover dj software mac download.
Open the Run/Debug Configuration window and add a new PHP script with the following settings:
- Name—Enter
bin/magento
. - Configuration > File—Select the path to the
bin/magento
file in your local environment.
- Name—Enter
Add breakpoints in the
bin/magento
file and the debug PHP script created in the previous step.
Using Xdebug Helper
You can install and use the Xdebug Helper Chrome extension to debug your PhP code from the browser.
Wsl2 Xdebug
To use Xdebug Helper with Chrome:
Docker Xdebug Phpstorm
Install the Xdebug Helper extension from the Chrome store.
Enable the extension in Chrome as shown in the following figure.
In Chrome, click in the Chrome toolbar.
From the Xdebug helper menu, click Options.
From the IDE Key list, select PhpStorm.
Click Save.