Sublime Text - Debugging PHP Application

Debugging is the process of finding errors and bugs in the given code and fixing them. Sublime editor includes various plugins that have debugging features, which helps in finding errors easily.

In this chapter, you will learn how to debug a PHP web application. Sublime uses Sublime TestX debug plugin for this purpose. The features of this plugin are −

  • It is an extension used for debugging the PHP files and scripts.

  • Provides a list of debugging and profiling capabilities.

  • Maintains stack traces and real time parameters like display and functionalities.

Installation of Sublime Plugin

To install Sublime Text Xdebug plugin, you will have to take the following steps −

Step 1 − Install package control palette installation with the shortcut of Ctrl+Shift+P or Cmd+shift+P.

Installation of Sublime Plugin Step1

Installation of Sublime Plugin Step1-2

Step 2 − After the successful installation of Xdebug client, the configuration file will be kept in the Installed Packages folder. The configuration file is the JSON file which includes the parameters for debugging a PHP web application.

Installation of Sublime Plugin Step2

Step 3 − Start the debug session of PHP file using the shortcut Ctrl+F9. You can also do it using the Start Debug option using command palette.

Installation of Sublime Plugin Step3

Step 4 − The split windows of XdebugClient will show the output of PHP file. It keeps a process of debugging code line by line. Refer to the following screenshot for a better understanding −

Installation of Sublime Plugin Step4
Kickstart Your Career

Get certified by completing the course

Get Started