Xdebug is a good helper for php debugging, and sublime is a good helper for php writing. Here only how to configure, the default reader will use sublime and xdebug to install xdebug in mac is very convenient: brewinstallphp55-xdebug and then configure, add xdebug. remote_enab in usrlocaletcphp5.5conf. dext-xdebug.ini
Xdebug is a good helper for php debugging, and sublime is a good helper for php writing. Here only how to configure, the default reader will use sublime and xdebug install xdebug in mac is very convenient: brew install php55-xdebug and then configure, in/usr/local/etc/php/5.5/conf. d/ext-xdebug.ini add xdebug. remote_enab
Xdebug is a good helper for php debugging, and sublime is a good helper for php writing. This document only describes how to configure it. By default, the reader will use sublime and xdebug.
Install xdebug
It is very convenient on mac:
brew install php55-xdebug
Then configure/usr/local/etc/php/5.5/conf.d/ext-xdebug.iniAdd
xdebug.remote_enable=1xdebug.remote_handler=dbgpxdebug.remote_host=127.0.0.1xdebug.remote_port=9000xdebug.remote_log="/var/log/xdebug/xdebug.log"
Restart apache
sudo apachectl restart
Configure sublime
To debug a project, you must first save the project as a project under sublime.
sublime->project->save project as ...
Use package control to installxdebug client
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 cannot be traced to 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.
Reference
- Debugging with Xdebug and Sublime Text 3
Original article address: Use Xdebug and Sublime to debug the PHP code. Thank you for sharing it with the original author.