MGT Development Environment - XDebug

Xdebug is the most common used debugger for PHP applications and a must-have for debugging Magento.

File Sync

To use xdebug, you need to sync the files from your host system to the container.

Follow the File Sync to set up a sync between your host system <--> container.

Configuration

To enable xdebug for e.g. PHP 7.4, do the following:

  1. Open the PHP FPM php.ini:
/etc/php/7.4/fpm/php.ini
  1. Go to the end of the file where you find the xdebug configuration:
;zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host=192.168.178.59
xdebug.client_port=9003
xdebug.max_nesting_level=500
  1. Uncomment the following line by removing the semicolon and configure your IP in xdebug.client_host.
;zend_extension=xdebug.so
  1. Restart PHP-FPM to apply the changes:
supervisorctl restart php-fpm7.4

PhpStorm

If you are using PhpStorm for the development, you can follow the Debug with PhpStorm: Ultimate Guide.