The first is the installation of the required components.
There are three, vim DBGP plugins, PHP xdebug extensions, Chrome browser Xdebug helper extensions.
One: Vim installation DBGP client plugin Download DBGP client
$ cd ~/.vim/$ wget Http://www.vim.org/scripts/download_script.php?src_id=7285-O debugger.zip$ Unzip Debugger.zip
II: PHP installation xdebug extension
The specific installation method will not speak, many online examples. Official installation instructions.
I post my configuration information:
[xdebug]zend_extension= "/home/s/apps/php-5.2.6/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so" Xdebug.profiler_enable=0 ; open profilexdebug.profiler_enable_trigger=1 ; Use a trigger to turn on Profilexdebug.profiler_ Output_dir= "/home/s/logs/xdebuglog" xdebug.auto_trace=0 ; open tracexdebug.trace_enable_trigger=1 ; Use a trigger to turn on tracexdebug.trace_output_dir= "/home/s/logs/xdebuglog" xdebug.cli_color=1xdebug.collect_params= 2xdebug.collect_return=on , Remote debug , xdebug.remote_enable=1xdebug.remote_autostart= offxdebug.remote_port=9000; The remote port, not the port of your Web service, is generally not modified if there is no conflict.
It is important to note that there is a comment, do not automatically open the profile and trace, because so each request will save the corresponding information, the disk will be blown off. Open the trigger so that the corresponding performance information is recorded only when the request has specific information. Trigger implementation mechanism is: when the request, if the Get/post/cookie information contains a specific variable, will open the corresponding debug,profile or trace, so we can access the page in the Web, add the corresponding variable to turn on the corresponding function. If each time you splicing this, also very troublesome, so will introduce the Xdebug helper of the chrome extension, want to open any function, click on the extension can be. In other words, this extension is not required for debugging, but it makes you feel comfortable using it.
Three: Chrome extension xdebug helper
Address: HTTPS://CHROME.GOOGLE.COM/WEBSTORE/DETAIL/XDEBUG-HELPER/EADNDFJPLGIELDJBIGJAKMDGKMOAAAOC
If searching for Xdebug helper in Chrome://apps, please change your language to Chinese.
xdebug-helper-introduction20140226142342
Xdebug Helper Two configuration note that the IDE key should be careful to select other, with a value of 1, and then save.
The second is the domain whitelist, if you do not want each page debugging debug icon, the development of the domain name to fill in, such as the localhost God horse. In fact, the icon is very small, not too much in the way, you can not set.
start using :
If you do not debug debugging, just need to record the profile and trace information, look at the performance problem, then it is very simple, directly in chrome access to the corresponding URL, will be on the right side of the URL to see a XDEBG Helper small icon, click, select Profile or trace, and then refresh, you can see the corresponding files in the pre-set directory.
cachegrind* is a profile file and trace* is a trace file.
You can easily view profile information by using Wincachegrind under Windows.
Xdebug_helper_debug_profile_trace
Xdebug_output_file_trace_profile
Wincachegrind_output
Finally, it's how to turn on remote debugging .
Use VIM to edit the program file, where it needs to be interrupted: BP command to break the breakpoint. Then press F5 to perform the monitoring.
At this time, Vim will prompt waiting for a new connection the port 9000 for 5 seconds ..., so this time you need to launch an interrupt request in 5s to the server, at the front URL, we put the Xdebug helper Debug Select, refresh the page, VIM will enter the interrupt. The right side of the relevant tips, we can follow the way gdb debugging. If you do not install XDEBUG helper, it does not matter, you manually stitching a parameter on the URL: &xdebug_session_start=1 can also open remote debugging.
Xdebug_remote_debug_how
Transferred from: HTTP://DIGDEEPLY.ORG/ARCHIVES/TAG/DBGP