Configure Xdebug In Sublime Text Editor For Magento Project

Updated: Aug 20

This article describe the step by step process of configure xdebug in sublime text editor for magento project.

1. Install Sublime Text Editor

If you already have sublime text editor please skip this step

For Sublime-Text-2:

sudo add-apt-repository ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get install sublime-text

For Sublime-Text-3:

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

2. Install Xdebug

Please run the below command to find the right xdebug package to install

sudo apt-cache search xdebug

It should return the information like below

php-xdebug – Xdebug Module for PHP

so we need to install php-xdebug (it may be vary like php5.6-xdebug, php7-xdebug….)

sudo apt-get install php-xdebug

Add the below contents at the end of /etc/php/your_version/apache2/php.ini

# Added for xdebug

Restart the apache

sudo service apache2 restart

3. Install Xdebug client in Sublime

Sublime -> View -> Show Console

Please paste the below content as per your sublime version in cosole like above screen shot then hit ENTER


import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( '' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)


import urllib2,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( '' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

Open up Command Pallete (Ctrl+Shift+P Windows/Linux; Cmd+Shift+P Mac OS users)

Start typing install. Press Enter when Package Control: Install Package appears

Type XDebug and choose XDebug Client

Restart sublime

4. Create Project

Open Magento 2 folder in Sublime Text after that go to Project->Save Project As and save it within the root of your magento application as mage2.sublime-project.

Then edit the sublime project (mage2.sublime-project) file content like below

			"path": "/var/www/html/magento-root"
	         "url": ""

That’s it!

When you have at least one breakpoint set, you can go to Tools->XDebug->Start Debugging (Launch Browser) and have fun

#magento #magento2 #sublime #xdebug


Recent Posts

See All

Follow Me

  • LinkedIn
  • Twitter
  • Facebook
  • YouTube
  • Instagram

©2020 by Bilal Usean. Proudly created with