This article will introduce to you the methods and specific steps to configure and install xhprof in window wamp. I hope these methods will be helpful to you.
1. Download here http://dev.freshsite.pl/php-extensions/xhprof.html If you cannot download it, you can send an email to 16090288@qq.com and explain the version.
I am using wamp 2.2d 32-bit. Here is a long-winded sentence. Since you are using wamp for windows, don’t install 64-bit. After all, it is a development environment, and the official environment must be 32-bit.
Download two files here XHProf 0.10.3 for PHP 5.3 vc9.zip xhprof_html.zip
2. Installation. 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, and then add the configuration to the php.ini configuration (don’t forget to create the corresponding file Clip)
The code is as follows
代码如下 |
复制代码 |
[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”
|
|
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”
代码如下 |
复制代码 |
xhprof_enable();//开始
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();//结束,然后写入文件,注意目录
$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 "分析";//
|
Just restart your wamp and see if there is a corresponding file in phpinfo()
| 3.Use:
Just unzip this file xhprof_html.zip to the root directory of the website you want to test
Nowadays, websites generally use frameworks. The best thing is that there is only one entrance. Just write it directly in index.php. I use the yaf framework
The code is as follows
|
Copy code
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 to the file, pay attention to the directory
$XHPROF_ROOT = realpath(dirname(__FILE__).'/xhprof');
include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.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 "Analysis";//
Just replace pztai here with your own domain name, and local host analysis";//Just replace pztai here with your own domain name, and local host
Still learning how to use it, write a few abbreviations
http://www.bkjia.com/PHPjc/629818.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/629818.htmlTechArticleThis article will introduce to you the methods and specific steps to configure and install xhprof in window wamp. I hope these methods will be useful to you. Classmates will be helpful. 1. Download here http://dev.freshsit...
|
|