好看的皮囊千篇一律,有趣的灵魂万里挑一。
2018-5-30
一、安装cd /usr/local/src git clone https://github.com/yuanshuli11/xhprof.git cd xhprof/extension/ /usr/bin/phpize ./configure --with-php-config=/usr/bin/php-config make make install出现
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20151012/表示编译成功
[xhprof] extension=xhprof.so xhprof.output_dir=/data/www/xhprof/save_output_dir //需要保证已创建该目录systemctl restart php-fpm 重启php
xhprof_enable(); //需要分析的代码 $xhprof_data = xhprof_disable(); include_once ROOT_PATH.'/xhprof_lib/utils/xhprof_lib.php'; include_once ROOT_PATH . '/xhprof_lib/utils/xhprof_runs.php'; $xhprof_runs = new XHProfRuns_Default(); $run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_test"); echo $run_id; //输出run_id 便于查看结果
标签: php性能