xhprof


xhprof


1.在pecl官网上下载http://pecl.php.net/package/xhprof
xhprof-0.9.4.tgz 放置到/url/local/src/目录
2.解压tar zxvf xhprof-0.9.4.tgz 


3.cd xhprof-0.9.4


4.cd extension/


5./home/work/app/php/bin/phpize 


6.  ./configure  --with-php-config=/home/work/app/php/bin/php-config 


7. make && make install 


Installing shared extensions:     /home/work/app/php/lib/php/extensions/no-debug-non-zts-20131226/
8.cd  /home/work/app/php/lib/php/extensions/no-debug-non-zts-20131226/  


9. 修改php.ini
extension=xhprof.so;
xhprof.output_dir=/home/work/logs/xhprof


10.使用图形:
wget http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.24.0.tar.gz
wget获取失败的话,直接上官网下载:https://graphviz.gitlab.io/_pages/Download/Download_source.html


tar zxvf graphviz-2.24.0.tar.gz
cd graphviz-2.24.0
./configure
make
make install


#修改/etc/profile,加入dot的PATH
PATH="$PATH:/usr/local/bin/dot"
export PATH




或者直接:
yum install -y graphviz 得了.


11.然后将/usr/local/src/xhprof-0.9.4  拷贝到自己 的www 目录下:
然后运行自带的示例:http://xhprof/examples/sample.php 
然后在查看运行后的结果:
http://localhost/xhprof/xhprof_html/

搞定了上面的步骤,熟悉了xhprof的原理及用途,那么接下来就是考虑如何将xhprof集成到自己的项目中了:

https://avnpc.com/pages/profiler-php-performance-online-by-xhprof

【大家可搜索并关注我的微信公众号,名称:jordy的世界
后续会有持续更新,更多精彩等着您!】






猜你喜欢

转载自blog.csdn.net/bawenmao/article/details/79554127