Using Xdebug in PHP

Source: Internet
Author: User
Tags php script zend

Heard Xdebug's name, and so see his time has been Xdebug 2.0.0RC3 release version, not used Xdebug 1.3.1, the feeling is that profile changes are relatively large, just need is the PHP profile function. I downloaded his doc.ta from him. r.gz, decompression, found inside, is a few txt files, later found that the written is still 1.3. On the official website of the online documentation to see that the download documents are backward, the main page above the document is very complete. And learn a little,

Often on his homepage to see if there is no update.

Installation is very smooth, is not know how to open after the function, the first to see the obvious change is var_dump ()

The output to become more beautiful, no longer found anything, debug function, currently do not need, feel the time debug, as, more than a few var_dump

and comment out some code, test a few more. Interrupt point and Start debug, it took too long.

Later xdebug.org/docs-profiling2.php

Find the profile document,

The File_get_contents function in PHP 5 is tested, and the same function is used in PhP4, which is written in PHP et_get_file_contents.

The test results are about 1:4 of the performance.

When you have time to write a point of detail,

Php.in to add Xdebug settings

zend_extension= "/opt/lib/xdebug.so"

Xdebug.profiler_enable=on

Xdebug.show_exception_trace=1

Xdebug.auto_trace=on

Xdebug.auto_profile=on

Xdebug.profiler_output_dir=/profile

Xdebug.profiler_output_name=script

Xdebug.profiler_append=1

zend_extension= "/opt/lib/xdebug.so"

Loading xdebug, using zend_extension rather than extension

Xdebug.auto_profile=on

Turn on automatic profile function

Xdebug.profiler_output_dir

Set up a data storage directory for Xdebug Profiler

Xdebug.profiler_output_name=script

Set Xdebug Profiler output data file with PHP script name

such as Mnt_d_phplib_phpsys2_phpinfo_php_cachegrind.out

otherwise cachegrind.out.1447918559

Xdebug.profiler_append=1

Whether to append to the file, the statistic results are calculated by the cumulative running times,

Or run the calculation every time, overwriting the results of the last profile.

Profiler output data file is relatively large, if all append words,

The stress test will produce, a lot of data, a small example above produces more than 540 K of data

www:/opt/apc-3.0.14 # Php-v

PHP 5.2.2 (CLI) (Built:may 5 2007 18:43:05)

Copyright (c) 1997-2007 the PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

With Xdebug V2.0.0rc3, Copyright (c) 2002, 2003, 2006, and by 2007 Derick

Set up/profile directory, belong to Daemon Group (Apache)

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.