Debugging with Xdebug on Sublime Text 3

Step 1 : Add following lines to your php.ini

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log="/var/log/xdebug/xdebug.log

After this, restart your local server( MAMP, WAMP, XAMP, etc…. ).

Step 2 : Install “Xdebug client” from package control. ( Press command/ctrl + shift + p and write “Install package” and press enter. And then write “Xdebug client” )

Step 3 : Open root of your project in sublime and do “save project as” on the root of the project. Then open that project file and add following lines ( Change url to your site )

"settings": {
"xdebug": {
"url": "http://localhost:8888/wordpress/",
}
}

Save the above project file and now from the sublime do this

you will see like ?XDEBUG_SESSION_START=sublime.xdebug. That means your xdebug session is started.

Step 4 : Add break point where you want to debug code. Go to particular line and do this.

Now go the page on the browser where that code executes.

You will see sub screens in sublime like this:

That’s it!!!! Congrats!!!!

Video for who doesn’t like to read.