php性能分析利器xhprof扩展安装(php7.2.0b3)
发布于 作者:苏南大叔 来源:程序如此灵动~
书接上回,苏南大叔在php5.6
下安装了xhprof
。换成了php7.2.0b3
环境下,原版的xhprof0.9.4
能编译,但是不能正常加载,提示phpapi
不匹配。本文中,苏南大叔就向大家介绍一下,php7.2.0b3
环境下,xhprof
的编译及加载。
第三方出品xhprof
扩展
在github上面有2个php7下的相关xhprof扩展repoistry,分别是:
都不是官方的出品的,是第三方出品。看上去前者longxinH/xhprof
更加接近原版,而且更好些,但是在苏南大叔的php7.2下面编译失败。后者yaoguais/phpng-xhprof
顺利编译通过,并顺利加载。但是后者看起来和原版的差距较大。
下载源码并解压
本文中,苏南大叔讲述下面这个版本的代码安装:
这个源码解压完毕后,和原来的目录结构是不一样的。根目录可以理解为原版的extension
目录。
编译源码
phpize
./configure
make clean && make && sudo make install #没有make test
生成的so文件名和原来的不一样,叫做phpng_xhprof.so
。
修改php.ini
[xhprof]
extension = phpng_xhprof.so
xhprof.output_dir = /tmp/xhprof
新的xhprof
版本号为0.9.5
。
总结
欢迎继续关注苏南大叔的后续xhprof
文章。https://newsn.net/tag/xhprof/ 。


