Use Xdebug for php Debugging

Source: Internet
Author: User
I personally think that for experienced programmers, using functions such as echo, print_r (), print_f (), and var_dump () is sufficient to Debug php code. if you do not like this, xdebug is a very good php debugging tool.

I personally think that for experienced programmers, using functions such as echo, print_r (), print_f (), and var_dump () is sufficient to Debug php code. if you do not like this, xdebug is a very good php debugging tool.

The installation tutorial is as follows:

1. first download the corresponding php_xdebug.dll ,:

Http://www.xdebug.org/download.php

2. copy the downloaded file to the ext directory in your php file.

3. edit the php. ini file and add the following information:

[Xdebug]

Zend_extension = D: \ xampp \ php \ ext \ php_xdebug.dll (Win)

Xdebug. profiler_enable = on

Xdebug. trace_output_dir = "../Projects/xdebug"

Xdebug. profiler_output_dir = "../Projects/xdebug"

The directory "../Projects/xdebug" after you want to place the Directory of the data file output by Xdebug, which can be set freely.


Parameter reference settings:

Xdebug. default_enable = on

; Displays the default error message

Xdebug. auto_trace = on

Automatically enable the "Monitor function call process" module. This function outputs the monitoring information of function calls in a file in the specified directory. The default value of this configuration item is off.

Xdebug. collect_params = on

To enable the function of collecting "function parameters. Include the parameter values of function calls in the monitoring information of function process calls. The default value of this configuration item is off.

Xdebug. collect_return = on

; Enable the function to collect "function return values. Include the return value of a function in the monitoring information of function call. The default value of this configuration item is off.

Xdebug. max_nesting_level = 100

Xdebug. profiler_enable = on

; Enable the Performance Monitor.

Xdebug. remote_enable = on

; Debugging or not

Xdebug. remote_host = localhost

Xdebug. remote_port = 9000

; Debug port

Xdebug. remote_handler = dbgp

; Select protocol

Xdebug. trace_output_dir = "d: \ Temp"

Set the path of the output file of the function call monitoring information.

Xdebug. profiler_output_dir = "d: \ Temp"

Set the path of the output file of performance monitoring information.


Now, the installation is complete. View:

Let's take a look at the debugging results. just try the wrong php code:
The following error message is displayed during access:

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.