Configure xdebug in eclipse for debugging

Source: Internet
Author: User
Tags php debugger

Configure xdebug for eclipse forphp

 

1. Why xdebug?

Xdebug is an open-source PHP program debugger (a debug tool) that can be used to track, debug, and analyze the running status of PHP programs.
Xdebug site: http://www.Xdebug.org

2. How to download and configure xdebug

Here, we only use wampserver as an example to illustrate how to open the PHP configuration file of wampserver and add the following content at the end of the file:

[Xdebug] zend_extension = "D:/Server/Wamp/bin/PHP/php5.3.13/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll"; turn on automatic tracking xdebug. auto_trace = on; Enable exception tracking; xdebug. show_exception_trace = on; enable remote debugging to automatically start xdebug. remote_autostart = on; enable remote debugging xdebug. remote_enable = on; Collect variable xdebug. collect_vars = on; collect the returned value xdebug. collect_return = on; collect the xdebug parameter. collect_params = onxdebug. trace_output_dir = "F: \ xampp_php53 \ debuginfo" xdebug. profiler_enable = onxdebug. profiler_output_dir = "F: \ xampp_php53 \ debuginfo" xdebug. remote_host = localhostxdebug. remote_port = 9000xdebug. remote_handler = dbgp

The DLL referenced in zend_extension is wampserver. Based on the built-in DLL of our PHP version, we can directly find its path and reference it. Suppose we are not using wampserver, it does not matter. We can go to xdebug.org to find our xdebug plug-in http://www.xdebug.org/wizard.php to enter this webpage, and paste the corresponding phpinfo (); printed information, it will automatically help you find the applicable version. If not found, you can search in xdebug.org manually. After xdebug is downloaded and PHP is configured, the following information is displayed.

 

When the above content appears, it indicates that xdebug has been configured.

3. Configure eclipse

The process of configuring eclipse is actually very simple. We will illustrate it with some diagrams below.

3.1 click window/preferences

Modify the PHP Execution Environment (you can modify the existing environment or create a new one)

Executable path and php ini file are filled in according to the actual path, and then select OK

 

3.2 modify debug Configuration

Click debug, change PHP debugger to xdebug, and change phpexecutable to the created environment.

The following break at firstline determines whether a breakpoint exists in the first line of each page during the debug process.

3.3 enable remote debugging (important)


Enabling remote debugging is a very important step. This is not described in most online tutorials. If you do not set it, you can only right-click eclipse, debugging in the form of scripts, rather than browsing through normal Web pages

Click debug/installeddebugger, double-click xdebug to configure xdebug, and select the accept remote session (JIT) as loclahost.

 

4 description

So far, the xdebug configuration of eclipse should have been successful and can be properly debugged. In fact, the debugging configuration is relatively simple, but most online strategies lack the 3.3 step, therefore, you should note that, if it still fails, please refer to other online instructions for relevant adjustments

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.