This article introduces how to configure and install xhprof in window wamp. I hope some methods will be helpful to you.
1. Download HERE http://dev.freshsite.pl/php-extensions/xhprof.html if you cannot download it down, you can send an email to the 16090288@qq.com to describe the version.
I am using wamp 2.2d 32-bit. Here, I am sorry, since windows wamp is used, I should not install 64-bit. After all, it is a development environment, the formal environment must be 32-bit
Download two XHProf 0.10.3 for PHP 5.3 vc9.zip xhprof_html.zip files.
2. install. This step is very simple. Rename the dll file in XHProf 0.10.3 for PHP 5.3 vc9.zip to php_xhprof.dll and put it in the ext directory of php. add configuration in ini 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 is any corresponding file in phpinfo ().
3. Use:
Unzip the xhprof_html.zip file to the root directory of the website you want to test.
Currently, websites generally use frameworks. The only entry point is the best. You can write them directly in index. php. I use the yaf framework.
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, and then write the file. Pay attention to the 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> ";// |
You can replace pztai with your own domain name, and perform local localhost analysis </a> "; // you can replace pztai with your own domain name.
I am still learning to use it.