Xhprof PHP Performance Test Kit Usage Summary

Source: Internet
Author: User
Tags zts
Xhprof PHP Performance test Tool Usage Summary

Xhprof is a lightweight PHP performance analysis tool introduced by Facebook, and the xhprof is more user-friendly and controllable than xdebug, especially the ability to generate flowcharts and debug data comparisons is very powerful. The following is a brief introduction of the installation and use of xhprof.

1. Installation

You can download the appropriate version from the page and understand the dependencies of each version. Before installing, let's assume that the PHP bin directory is:/usr/local/php/bin

[Root@localhost extension]# ln-s/usr/local/php/bin/phpize/usr/bin/phpize[root@localhost tool]# wget/http Pecl.php.net/get/xhprof-0.9.2.tgz[root@localhost tool]# tar-zxvf xhprof-0.9.2.tgz [root@localhost tool]# CD Xhprof-0.9.2/extension/[root@localhost tool]#./configure--with-php-config=/usr/local/php/bin/php-config[ Root@localhost tool]# make[root@localhost tool]# make install

With the above action, if luck is not very bad, you should see a hint like this: Installing Shared extensions:/usr/local/php/lib/php/extensions/ no-debug-non-zts-20060613/

Enter the PHP extension Library directory/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/and you will see the Xhprof.so shared library file.

2. Configuration

In the php.ini file, add the following configuration:

[Xhprof]extension=xhprof.so;; Directory used by default implementation of the Ixhprofruns; Interface (namely, the Xhprofruns_default Class) for storing; Xhprof runs.; xhprof.output_dir=
 
  
   
  xhprof.output_dir=/tmp/xhprof
 
  

Restart the PHP, you can use the xhprof.

3. Copy files

Copy all the files under directory xhprof_html and Xhprof_lib under the xhprof-0.9.2 directory to your website's home directory, assuming the site home directory:/opt/wordpress

[Root@localhost xhprof-0.9.2]# cp-r xhprof_*/opt/wordpress

4. Use

Refer to the following explanatory notes:

 
  Save_run ($data, "xhprof"); The value of the Url//run to view the results of the run is derived from the Save_run return value//source value from the second parameter of Save_run                                 //www.abc.com need to replace echo with its own domain name "/http" Www.abc.com/xhprof_html/index.php?run= ". $run _id." &source=xhprof ";

Open the URL of the output in the browser, and you can see the related performance information.

  • 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.