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.