Skip to content

Debugging with Xdebug

Dmitry Shkoliar edited this page Nov 4, 2019 · 6 revisions

Mage2click toolset supports Magento debugging with Xdebug out of the box. Only a few configuration steps are required.

In this configuration example, we're covering the PHPStorm IDE.

Configuration

Open Servers preferences section.

Preferences | Languages & Frameworks | PHP | Servers

Add the new server to match your project and configure path mappings. Your project directory must be mapped to /var/www/html path. Don't forget to press Apply or OK button. Check the screenshot below as reference. After that, go to the PHP preferences section.

Preferences | Languages & Frameworks | PHP

Select PHP language level to match PHP version used in your Magento project.

For CLI Interpreter, click on three dots to add a new one. A new CLI Interpreters dialog box will appear, press on plus (+) sign and choose From Docker, Vagrant, VM, Remote... In the appeared dialog box, select Docker and for Image name choose mage2click xdebug Docker image with corresponding PHP version to your Magento project, for example mage2click/m2c:php-fpm-7.2-xdebug-alpine. Press OK. Also, press OK on CLI Interpreters dialogue box. Make sure that newly created CLI Interpreter is selected and press OK on PHP preferences section.

Usage

To start/stop debugging, press Start/Stop Listening for PHP Debug Connections button. On the browser side, you will need to set XDEBUG_SESSION cookie to activate Xdebug or simply use Xdebug Helper browser extension for that.

IMPORTANT! Be aware that when you have activated debugging in the browser or have set XDEBUG_SESSION cookie value, Xdebug remains active even if you are not activating debugging at IDE side! For best performance, deactivate debugging in the browser or unset XDEBUG_SESSION cookie value when you are not debugging.

Clone this wiki locally