Xdebug is a good helper for php debugging, and sublime is a good helper for php writing. Here we only talk about how to configure it. By default, readers will use sublimetext and Xdebug as a good helper for php debugging and sublime as a good helper for php programming. Here we only describe how to configure it. By default, the reader will use sublime text and Xdebug
Install Xdebug
Install and configure the PHP debugging tool Xdebug in Ubuntu 12.04
Installation in Windows: Installation and Use of PHP debugging tool Xdebug -- a brief introduction to Xdebug
In the PHP configuration file phpl. ini, xdebug needs to enable remote_enable:
xdebug.remote_enable = on
Otherwise, the Xdebug Client will not work properly.
Configure Sublime Text
To debug a project, you must first save the project as a project under sublime:
sublime->project->save project as ...
Then install Xdebug Client using package control:
Ctrl+Shift+P->PCI->Xdebug Client
Next, configure the project:
sublime->project->edit poject
The configuration file is similar to the following:
{ "folders": [ { "follow_symlinks": true, "path": "." } ], "settings": { "xdebug": { "url": "http://my.local.website/", } }}
Here, the url is the project url. remember to point this url to 127.0.0.1 in hosts, and point it to the project root directory in apache's virtualhost.
In this case, OK. prepare to enable debugging.
Enable debugging
Enabling debugging is also relatively simple. right-click the place where you want to add a breakpoint
xdebug->Add/Remove breakpoint
In this way, the project will stop when it is running to the bank.
Start Debugging and select
tools->xdebug->start debugging(launch browser)
Sublime will automatically open the browser, enter the link of the website written during configuration, and debug
You can right-click the functions used in debugging in the debugging file to view them.
Possible problems
Failed to track breakpoints
This may be because the xdebug port is occupied. press Ctrl + 'or the menu bar View-> show Console to View the error message. it may be because the xdebug port is occupied.
Disable debugging in sublime xdebug, or restart sublime to solve this problem.