debugging PHP programs with Xdebug

Source: Internet
Author: User
Tags ini phpinfo zend

What is Xdebug?

Xdebug is a php extension for debugging PHP programs that can provide a lot of useful debugging information.

Installation of 1.Xdebug

First of all, let's assume that our development platform is Windows XP with Apache installed and php,php installed in the C:\php directory.

First go to Xdebug's official website http://xdebug.org/to download your PHP version of the xdebug DLL file, download it down in the PHP ext directory (C:\php5\ext), you can follow the other extensions of the naming method, Remove the rear xdebug version number directly into Php_xdebug.dll.

Then modify the php.ini, first find the location of the php.ini configured on your machine (C:\php\php.ini or C:\windows\php.ini), add the Xdebug configuration information at the end of the file.

[Xdebug]

Zend_extension_ts= "C:/php/ext/php_xdebug.dll"

Xdebug.auto_trace=on

Xdebug.collect_params=on

Xdebug.collect_return=on

Xdebug.trace_output_dir= "C:\Temp\xdebug"

Xdebug.profiler_enable=on

Xdebug.profiler_output_dir= "C:\Temp\xdebug"

Parameter explanation:

Zend_extension_ts= "C:/php/ext/php_xdebug.dll"

Load Xdebug, can not be loaded in extension=php_xdebug.dll way, must be loaded in a ZEND way, otherwise installed, phpinfo print out of the Xdebug section will have must LOADED as ZEND Warning message for extension (unknown reason).

Xdebug.auto_trace=on;

Automatically opens the "Monitoring function call procedure", which can output the monitoring information of function calls as files in the directory you specify. The default value for this configuration entry is off.

Xdebug.collect_params=on;

To open the feature that collects function parameters. The parameter values of the function call are included in the monitoring information of the Function procedure call. The default value for this configuration entry is off.

Xdebug.collect_return=on

To open the collection function return value function. The return value of the function is included in the monitoring information of the Function procedure call. The default value for this configuration entry is off.

Xdebug.trace_output_dir= "C:\Temp\xdebug"

To set the path of the output file where the function calls the monitoring information, note that this directory needs to be manually built.

Xdebug.profiler_enable=on

, open the Performance Monitor.

Xdebug.profiler_output_dir= "C:\Temp\xdebug";

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

There are some more specific parameter settings, see: http://www.xdebug.org/docs-settings.php

Once configured, restart Apache, and use Phpinfo () To view information about the Xdebug extension as follows.

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.