Is their any way to configure xdebug on linux+magento+sublime debug environment ?
I am using PHP Version 7.3.26-1+ubuntu18.04.1+deb.sury.org+1
Configure Xdebug for Magento 2
I assumed you have already installed below softwares
Xdebug Installation
sudo apt-get install php-xdebug
sudo apt-get install php7.4-xdebug
Locate xdebug.ini file
First we need to find the xdebug.ini file for both command line php and apache fpm php.
First we will find out xdebug.ini for apache fpm.
Create a new php page add phpinfo() function add open url using browser. We will get the xdebug.ini file path.
Apache fpm xdebug.ini file path is
/etc/php/7.4/apache2/conf.d/20-xdebug.ini
php --ini
/etc/php/7.4/cli/conf.d/20-xdebug.ini
PHP configuration for xdebug
zend_extension=xdebug
sudo service apache2 restart
Verify xdebug installation
On command line we can verify xdebug installation using command line
php -v
On apache2 web server create a php page and below code.
echo xdebug_info();
Xdebug configuration
sudo nano /etc/php/7.4/apache2/conf.d/20-xdebug.ini sudo nano /etc/php/7.4/cli/conf.d/20-xdebug.ini
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.idekey=sublime.xdebug
xdebug.client_host=127.0.0.1
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
Sublime Text 4 Configuration
Please make sure you have already installed Package Control. If you not installed package control, Please install this using below link https://packagecontrol.io/installation
Start sublime text editor. Go to “Tools > Command > Palette” search for the install package.
Now search for the “Xdebug Client” package and install this package. https://packagecontrol.io/packages/Xdebug%20Client https://github.com/martomo/SublimeTextXdebug
Open sublime project file (projectName.sublime-project) and add below code.
"settings": { "xdebug": { "url": "http://m2p/index.php", "super_globals": true, "close_on_stop": true } }
Here http://m2p/index.php is our magento website link.
Start/Stop the Xdebug session
Now we will start the xdebug session. Go to “Tools > Xdebug > Start Debugging (Launch Browser)”
This will start the xdebug session. This will also open your website home page with “?XDEBUG_SESSION_START=sublime.xdebug” added in the url.
Troubleshooting
Happy debugging
Thank You