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 8.1, do the following:
- Open the PHP FPM php.ini:
nano /etc/php/8.2/fpm/php.ini
- 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.132
xdebug.client_port=9003
xdebug.max_nesting_level=500
- Uncomment the following line by removing the semicolon and configure your IP in
xdebug.client_host
.
;zend_extension=xdebug.so
- Restart PHP-FPM to apply the changes:
supervisorctl restart php-fpm8.2
PhpStorm
If you are using PhpStorm for the development, you can follow the Debug with PhpStorm: Ultimate Guide.