: This article describes how to install the PHP performance testing tool xhprof for Windows + Apache22 + PHP53. if you are interested in the PHP Tutorial, refer to it. Link: http://blog.snsgou.com/post-816.html
1. download XHProf
Here the http://dev.freshsite.pl/php-extensions/xhprof.html downloads Windows version of XHProf, I choose to download here
XHProf 0.10.3 for PHP 5.3 vc9 and xhprof_html
2. install XHProf
Copy the xhprof_0.10.3_php53_vc9.dll in the compressed package to the PHP ext directory, and add the configuration in the php. ini configuration (do not forget to create the corresponding folder)
[xhprof]extension=xhprof_0.10.3_php53_vc9.dll; directory used by default implementation of the iXHProfRuns; interface (namely, the XHProfRuns_Default class) for storing; XHProf runs.xhprof.output_dir="d:/PHP/xhprof/log"
3. use XHProf
Decompress xhprof_html.zip to the root directory of the website you want to test. for example, if I have stored it in/public/xhprof/windows.
Test File:
0) {bar ($ x-1) ;}} function foo () {for ($ idx = 0; $ idx <5; $ idx ++) {bar ($ idx); $ x = strlen ("abc") ;}// start xhprofxhprof_enable (XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY); // call the foo function, it is also the function foo () to be analyzed; // stop xhprof $ xhprof_data = xhprof_disable (); // Obtain the statistical data // print_r ($ xhprof_data); $ OS = 'windows '; $ XHPROF_ROOT = dirname (_ FILE __). '/public/xhprof /'. $ OS;Include_ Once $ XHPROF_ROOT. "/xhprof_lib/utils/xhprof_lib.php ";Include_ Once $ XHPROF_ROOT. "/xhprof_lib/utils/logs"; // save statistics and generate the statistics ID and source name $ xhprof_runs = new XHProfRuns_Default (); $ run_id = $ xhprof_runs-> save_run ($ xhprof_data, "xhprof_foo"); // The source name is xhprof_foo // view the statistics echo"XHProf view
";
When you click [View Full Callgraph], an error is returned:
Failed to execute cmd: "dot-Tpng"
Therefore, you also need to download the graphic tool Graphviz.
4. download Graphviz
Here the http://www.graphviz.org/Download_windows.php downloads Windows version of Graphviz, I choose to download here
Graphviz-2.38.zip
5. install Graphviz
After decompression, copy Graphviz to a directory, such as d:/PHP/xhprof/graphviz-2.38/
6. configure Graphviz
Find the config. php file in the directory/public/xhprof/windows/, and adjust it as follows:
Click the [View Full Callgraph] link again, which is coming soon:
Apache22 + PHP 53 install PHP performance testing tool xhprof "/>
The above describes how to install the PHP performance testing tool xhprof for Windows + Apache 22 + PHP 53, including the include content, and hope to help those who are interested in the PHP Tutorial.