1. Download here http://dev.freshsite.pl/php-extensions/xhprof.html if you do not download it, you can send 16090288@qq.com email, explain the version.
I use the Wamp 2.2d 32-bit, here wordy, since the use of Windows Wamp, do not install 64-bit, after all, is the development environment, the formal environment must be 32-bit
Download two files Xhprof 0.10.3 for PHP 5.3 vc9.zip Xhprof_html.zip
2. Installation. This step is very simple, the xhprof 0.10.3 for PHP 5.3 vc9.zip DLL file renamed to Php_xhprof.dll placed in the PHP ext directory, and then in the PHP.ini configuration to add configuration (do not forget to create the corresponding folder)
The code is as follows |
Copy Code |
[Xhprof] Extension=php_xhprof.dll ; Directory used by default implementation of the Ixhprofruns ; Interface (namely, the Xhprofruns_default Class) for storing ; Xhprof runs. Xhprof.output_dir= "D:/wamp/logs/xhprof_log" |
Restart your wamp to see if there are any files in phpinfo ()
3. Use:
Xhprof_html.zip this file into the root directory of the site you want to test.
Now the site is generally used is the framework, the only entry point is the best, directly in the index.php inside write is good, I use the YAF frame
The code is as follows |
Copy Code |
<?php Xhprof_enable ()/Start Require ' init.php '; Require ' conf/db.inc.php '; $app = new Yaf_application (Base_path. "/conf/itxiangqin.ini"); Yaf_registry::set (' config ', Yaf_application::app ()->getconfig ()); $app->bootstrap ()->run (); $xhprof _data = xhprof_disable ();//end, then write file, note directory $XHPROF _root = Realpath (dirname (__file__). /xhprof '); Include_once $XHPROF _root. "/xhprof_lib/utils/xhprof_lib.php"; Include_once $XHPROF _root. "/xhprof_lib/utils/xhprof_runs.php"; Save raw data for this profiler run using default Implementation of Ixhprofruns. $xhprof _runs = new Xhprofruns_default (); Save the run under a namespace "Xhprof_foo" $run _id = $xhprof _runs->save_run ($xhprof _data, "Xhprof_foo"); echo "<a href= ' http://www.pztai.com/xhprof/xhprof_html/?run= $run _id&source=xhprof_foo ' > Analysis </a>"; / |
Here Pztai to your own domain name is good, local localhost analysis </a> ";//here Pztai to your own domain name is good, local localhost
Still learning to use, write a few abbreviations