Postscript: I haven’t used the Sublime Text editor in a long time. Now that writing front-end and PHP has switched to VSCode, JAVA and Kotlin have switched to IntelliJ IDEA

Install Xdebug

  1. Download the corresponding version https://xdebug.org/download.php DLL, in PHP ext directory.
  2. Configure php.ini and append the following:

[XDebug] zend_extension = “php_xdebug – against 2.4.1-5.6 – vc11 – NTS – x86_64. DLL” XDebug. Remote_enable = 1 XDebug. Remote_host = “localhost” xdebug.remote_port=9000 xdebug.remote_handler=”dbgp” xdebug.remote_mode=req xdebug.remote_connect_back=1

Note Enter the DLL path based on the actual situation. Do not change host and port, which are the default Settings of the Sublime Text Xdebug client plug-in. If there is a port conflict can be modified, or other configuration can achieve remote debugging.

Install the Sublime Text Xdebug Client plug-in

  1. This article assumes that you have experience with Sublime Text package manager, so this step is a straightforward installation of the Xdebug Client. If not, start by researching how to use the package manager.
  2. Configure the project (this step is not required) add the following configuration to the project file *.sublime-project. This step is simply to enable the editor to quickly open the project address (with the debug key attached). We will be using the Xdebug Helper Chrome plugin, so this step is not necessary and can be skipped.

“Settings “: {“xdebug”: {” URL “:” project access address “}}

Install the Xdebug Helper Chrome plug-in

  1. Install Xdebug Helper. Ladders can be installed by themselves.
  2. Right-click the plug-in to go to the options page and make the following configuration:

    Fill in the IDE keysublime.xdebugAnd then save. Of course, this value can also be configured in the Sublime Text Xdebug Client plug-in. What this step does is provide a key (either through the URL parameter or through a cookie) to the PHP server, indicating that we want to debug the page.

Use Xdebug client

  1. The browser opens the address to debug and turns Xdebug Helper on (green).
  2. Break points in the editor: Try right-clicking on a line of source code and looking at Xdebug’s menu options.
  3. Choose > Tool >Xdebug to enable Debug, and you can also view related options, as well as shortcut keys.
  4. Refresh the page.
  5. Go back to the editor and look at the variable information in the following two Windows to try single-step debugging.

reference

  1. http://yansu.org/2014/03/20/php-debug-with-xdebug.html
  2. https://quericy.me/blog/196/