Configure the PHP debugging environment Vim + XDebug on Ubuntu

Source: Internet
Author: User
Directly go to the topic. The following configuration assumes that you have configured the PHP environment. 1. install the full version of Vim. If you have installed it, skip this step because Ubuntu only installs a reduced version of The Vimsudoapt-getinstallvim-full2 by default. run the: sudoapt-getinstallphp-pear3 if pecl is not installed on the machine. install and configure XDebugsudopeclinstallxdeb

Enter the topic directly. The following configuration assumes that you have configured the PHP environment.

1. Install Vim in the full version. If you have already installed Vim, skip this step because Ubuntu only installs Vim in the reduced version by default.
Sudo apt-get install vim-full

2. If pecl is not installed on the machine, run:
Sudo apt-get install php-pear

3. install and configure XDebug
Sudo pecl install xdebug

4. Add XDebug configuration in/etc/php5/apache2/php. ini.
Zend_extension =/usr/lib/php5/20090626/xdebug. so
Be sure to use your own path
Xdebug. remote_enable = on
Xdebug. remote_handler = dbgp
Xdebug. remote_host = localhost
Xdebug. remote_port = 9001

5. Restart the server
Sudo/etc/init. d/apache2 restart

6. Install the Vim Debugger plug-in
Http://www.vim.org/scripts/script.php? Script_id = 1, 1929
Copy debugger. py and debugger. vim In the plugin directory to the $ HOME/. vim/plugin directory.

7. Set the port number to be listened on by the dbgp client in the. vimrc file.
Let g: debuggerPort = 9001

8. Run vim to open the Php source file and set the breakpoint in one line.
: Bp

Press F5 and enter http://www.linuxidc.com/yourphp in your browser in 5 seconds? XDEBUG_SESSION_START = 1

VIM enters the single-step execution stage

The configuration is complete here, and I feel that this is not very useful.

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

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.