XDEBUG + MyEclipse Single-step tracking debug PHP code

Source: Internet
Author: User
Tags php debug php debugger
XDEBUG + MyEclipse Single-step tracking debug PHP code
1. Xdebug
Xdebug is an open source PHP program debugger (i.e. a debug tool) that is quite powerful and can be used to track, debug and analyze the health of PHP programs. Xdebug now the latest version is xdebug 2.1.0, download page is http://xdebug.org/download.php, note that the page download links have multiple (such as), according to their own number of computers and PHP version to choose, To figure out the version of PHP and whether it is thread-safe (viewed through the Phpinfo function), the PHP5.3 version of the user also needs to know which compiler compiled their PHP to download the VC6 or VC9 version. For example, my PHP version is 5.2.x and thread safe, so choose 5.2 VC6 Download, the file name is Php_xdebug-2.1.0-5.2-vc6.dll:

2. Eclipse
Eclipse is an open-source, Java-based, extensible development platform. For its part, it is just a framework and a set of services for building a development environment through plug-in components. Using it, we can provide a lot of convenience for PHP development, the software can be downloaded on its website.
Installation and configuration:
1. Installing Xdebug
The installation of Eclipse will not be said. Xdebug installation method is not difficult, first the download to the file renamed to Php_xdebug.dll placed in the ext/directory of PHP, and then modify the php.ini file, add the following lines at the end of the file:
[Xdebug]
; Specify the location of the Xdebug extension file (the path should be adjusted according to your own situation)
Zend_extension_ts = "F:/library/php_xdebug-2.1.0-5.2-vc6.dll"
; Enable Xdebug remote Debugging
xdebug.remote_enable = 1
; The following Xdebug debugging options are actually default values
Xdebug.remote_host = localhost
Xdebug.remote_port = 9000
Xdebug.remote_mode = req
Xdebug.remote_handler = DBGP
TS in Zend_zend_extension_ts is thread-safe, if your PHP is not thread-safe, write Zend_extension. See http://xdebug.org/docs/all_settings for complete configuration items and descriptions.
After saving php.ini, restart the server, view the output of phpinfo (), if you can see the following screen on the page, the installation is successful:


2. Configure debug options in Eclipse
I'm using eclipse for PHP developers Helios, and the other versions are similar. First, on the left side of window---Preferences, choose Debug (such as) PHP, on the right side of the PHP debugger to select the Xdebug, this option has a configure link to the right, Click inside to set the Xdebug, make sure that the port number used by Xdebug is the same as specified in the php.ini file (typically 9000), the following two items are set up for the Web server and the PHP interpreter, and the following break at first line indicates that the debug starts after the 1th break:

Program Debugging:
After setting up the program can be debugged, click on the tool bug-like debug as, here can choose to be in the form of Web pages or PHP script debugging (such as):

The current workspace view will switch to PHP debug, and then the program will be broken in line 1th, and then you can do one-step debugging (such as), debugging methods do not say, their own groping, in short, is very convenient:

To see the picture, please click the link (people a bit lazy, the figure below this link has):

http://hi.baidu.com/yan_zy/item/91874f04d745d13a4ac4a384
  • 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.