XDebug debugging and unit test coverage analysis-PHP Tutorial

Source: Internet
Author: User
Use XDebug debugging and unit test coverage rate analysis. Today, I will share some of my experiences with XDebug. XDebug is installed only when it is used to generate a Coverage Analysis file. Recently, I used it myself today. XDebug To share some of your experiences. XDebug This is also because it is installed only when it is used to generate a Coverage Analysis file. it is not frequently used in recent contacts, but it is indeed a good tool, if you want to rely on it to analyze program performance, you still need to try it yourself. How nice it is, please let me know one by one.

I, Installation(XDebugAndPHPUnit)

A: InstallationXDebug:

XdebugDownload from the internetXdebug DllFile, stored inPhpLoadedExtDirectory (you can choose to rename, suchPhp_xdebug.dll,Then openPhp. iniFile, add configuration

[Xdebug]

Zend_extension_ts = php_xdebug.dll

Xdebug. profiler_enable = on

Xdebug. trace_output_dir = D: \ PHPAPP \ XDebug

Xdebug. profiler_output_dir = D: \ PHPAPP \ XDebug

XdebugUseZendThereforeZend_extension_tsOrZend_extension, TsYesThread_safety,Currently5.3Only supportedZend_extensionLoad,<5.3UseZend_extension_tsLoad (or you can viewPhpinfoEnabled or notZts), And then restartApache,ViewPhpinfo,You will findXDebugOption.


We can see thatXdebug. profiler_enable,Xdebug. profiler_output_dir,Xdebug. trace_output_dirThe three items are just configured. you can install your own items and configure the remaining items,Xdebug. profiler_enable: Enable performance analysis,

After this feature is enabledXdebug. profiler_output_dirGenerated under this directoryCachegrind. out. XXXIf you specifyXdebug. profiler_output_nameThe output file will be the specified name.. Xxx(This method is not suitable for analysis, the reason will be explained later ),

Xdebug. trace_options: This is to enable tracking,

After this option is enabledXdebug. trace_output_dirProduction tracking file,Note that this option will affect the running speed because it needs to record a series of events in the tracking process.

AboutXDebugNote the following:XDebugYes, that is, the configurationXDebugThe program is runningDebugStatus, so this timeZend_optimizerIt cannot be used, and the program cannot be debugged or optimized.

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.