XDEBUG + MyECLIPSE single-step tracing and debugging of PHP code

Source: Internet
Author: User
Tags php debug php debugger
XDEBUG + MyECLIPSE single-step tracking and debugging of PHP code 1. xdebugXdebug is an open-source PHP program debugger (a Debug tool), which can be used to track, Debug, and analyze the running status of PHP programs. The latest version of Xdebug is Xdebug2.1.0. the download page is http: // x XDEBUG + MyECLIPSE.
1. Xdebug
Xdebug is an open-source PHP program debugger (a Debug tool), which can be used to track, Debug, and analyze the running status of PHP programs. Xdebug is now the latest version of Xdebug 2.1.0, the download page is a http://xdebug.org/download.php, pay attention to the download link on the page has multiple (such as), according to your computer number and PHP version to choose, find out your PHP version and whether it is thread-safe (view through the phpinfo function ), PHP5.3 users also need to know which compiler is used to compile their PHP to download VC6 or VC9. For example, my PHP version is 5.2.x and thread-safe, so choose 5.2 VC6 (32 bit) download, the file name is php_xdebug-2.1.0-5.2-vc6.dll:

2. Eclipse
Eclipse is an open-source and Java-based scalable development platform. In itself, it is only a framework and a set of services, used to build a development environment through plug-in components. Using it can bring a lot of convenience to our PHP development, and the software can be downloaded on its official website.
Installation and configuration:
1. install Xdebug
The installation of Eclipse will not be mentioned. The Xdebug installation method is not difficult. first, rename the downloaded file to php_xdebug.dll and place it in the ext/directory of PHP. then modify the php. ini file and add the following lines at the end of the file:
[Xdebug]
; Specify the location of the xdebug extension file (adjust the path 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 indicates thread security. if your PHP is not thread security, write it as zend_extension. For complete configuration items and descriptions, see the http://xdebug.org/docs/all_settings.
Save php. ini and restart the server to view the output of phpinfo (). if the following figure is displayed on the page, the installation is successful:


2. configure the debug option in Eclipse
I am using Eclipse for PHP Developers Helios. Other versions are similar. First, select PHP> Debug (for example) on the left of Window> Preferences, and select XDebug from PHP Debugger on the right of Window. there is a Configure link on the right of this option, click in to set XDebug. make sure that the port number used by XDebug is the same as that used by php. the specified INI file is the same (usually 9000). the following two items are used to set the web server and the php interpreter. then, the following Break at first line indicates that the system is disconnected from line 1st after the debugging starts:

Program debugging:
After the configuration is complete, you can Debug the program. click the bug on the tool-> Debug As. here you can Debug the program in the form of a web page or a PHP script (for example ):

If it succeeds, the current workspace view will be switched to PHP Debug, and the program will be disconnected in line 1. then you can perform one-step debugging (for example). The debugging method will not be much said, I am exploring for myself. In short, it is very convenient:

To see the figure, click the link (a person is a little lazy, as shown in the following link ):

Http://hi.baidu.com/yan_zy/item/91874f04d745d13a4ac4a384

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.