Three tips for optimizing PHP with Xdebug

Source: Internet
Author: User

Xdebug's 2.0 official edition has been released. This tool is used in PHP code debugging, Optimization effect is very good. Here are some tips for using the process.

Xdebug generates profile files that can be viewed with kcachegrind, but this tool is available only under Linux and does not have a version under Windows. A win free tool--wincachegrind is recommended here, and you can view the Xdebug profile file, which is used to analyze the PHP code to run enough (occasionally unstable).

Xdebug generally only a request to do profile records, if you need to see a few requests for the operation of the collection, you can set Xdebug.ini Xdebug.profiler_aggregate = 1 Remember to restart your Apache.

If the xdebug.profiler_enable = 1 is set in the Xdebug.ini, then Xdebug will record profile every time the program runs, which has a great effect on the speed of the program. To avoid this, you can let Xdebug run only when needed--set Xdebug.profiler_enable_trigger = 1 so that only if you submit the Xdebug_profile variable in get/post way, Xdebug will begin to work.

Another: The latest version of the Xdebug and APC used at the same time, did not appear compatibility problems, running well.

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.