Configure dbgp in VIM to debug the PHP Program

Source: Internet
Author: User
VIM + xdebug debug php1. install xdebug
Sudo apt-Get install php5-xdebug

2. Configure xdebug
Edit/etc/PhP5/apache2/CONF. d/xdebug. ini and add
Xdebug. remote_enable = 1
Xdebug. remote_port = 9000
Xdebug. remote_host = localhost

3. Install the vim plug-in dbgp
Download: http://www.vim.org/scripts/script.php? Script_id = 1, 1929
Download the package and put it in the Plugins directory.

4. Open the PHP page to be debugged in the browser and add? Xdebug_session_start = 1 parameter
Open this file with vim, set the breakpoint with: bp, and then set the F5 key. VI will prompt waiting for a new connection on port 9000 for 5 seconds... In five seconds, refresh the page and you can see the debugging interface in Vim.

If attributeerror ("dbgprotocol instance has no attribute 'stop'" appears, it indicates that the configuration is successful or xdebug. remote _ * is not configured, or is it not added at the end of the URL? Xdebug_session_start = 1, or you have not refreshed the page within 5 seconds.

5. when getting the variable content, if the variable is array, only (array) will be displayed by default, instead of all elements in the array. If the array element content cannot be displayed, therefore, debugging may encounter many problems. comments in Vim are stored in. add the following line to vimrc:

Let G: debuggermaxdepth = 5
More configurations are described in debugger. vim.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.