centos6 安装xhprof扩展
首先配置yum源
追加CentOS 6.5的epel及remi源
# rpm -Uvh http:
//ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http:
//rpms.famillecollet.com/enterprise/remi-release-6.rpm
检查已安装的php包
# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
安装php5.6
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit
php-pecl-xdebug php-pecl-xhprof
查看php版本
# php --version 或 php -v
安装php-fpm
# yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
以上只是准备工作!!!
# wget http://pecl.php.net/get/xhprof-0.9.4.tgz
# tar zxvf xhprof-0.9.4.tgz
# cd xhprof-0.9.4
# whereis phpize
# /usr/bin/phpize #上一步得到的命令所在位置
如果报以下错误
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize'in the top level source directory of the module
则
在当前目录下进入extension目录下:
# cd extension/
# ls config.m4 php_xhprof.h tests xhprof.c
# phpizeConfiguringfor:PHPApiVersion:20100412ZendModuleApiNo:20100525ZendExtensionApiNo:220100525
然后编译安装:
# whereis php-config #查找php-config的位置 # ./configure --with-php-config=/usr/bin/php-config #/usr/bin/php-config 上一步的结果 # make && make install
没报错就说明安装成功,然后就是在php.ini加入扩展
# vim /etc/php.ini
在文件中添加一句:
extension = xhprof.so
重启php-fpm生效
# service php-fpm restart
安装xhprof扩展已经完成
如何使用xhprof
将文件拷贝到网站目录里面,然后添加监控代码到统计文件中,这一步是引入文件
# mkdir -p /
home/www/xhprof && cd /home/www/xhprof/
之前是在tmp目录下下载xhprof-0.9.4包
# cp -r /tmp/xhprof-0.9.4/xhprof_html/ ./
# cp -r /tmp/xhprof-0.9.4/examples/ ./
# cp -r /tmp/xhprof-0.9.4/xhprof_lib/ ./# mkdir logs 项目中的使用方法(打点):1.开始标志xhprof_enable(); 2.被包含的函数体,也是项目中需要检测的函数function(); 3.结束标志 $data = xhprof_disable(); $xhprof_root = "/home/wwwroot/xhprof"; include_once $xhprof_root."/xhprof_lib/utils/xhprof_lib.php"; include_once $xhprof_root."/xhprof_lib/utils/xhprof_runs.php"; $xhprof_runs = new XHProfRuns_Default(); $run_id = $xhprof_runs->save_run($data, "test"); 访问路径:
xxx.
xxx.xxx.xxx 代表服务器主机
http://xxx.
xxx.xxx.xxx/xhprof/xhprof_html/index.php?run=$run_id&source=test
个人觉得打点到访问这个过程可以封装起来,方便使用
其中[View Full Callgraph]按钮可以查看耗时情况分布图,如果点击出现以下报错:
Error: either we can not find profile data for run_id 58b393370e400 or
the threshold 0.01 is too small or you do not have 'dot' image generation utility installed.
错误︰ 我们不能为 run_id 58b393370e400 找到配置文件数据或 0.01 阈值是太小或您没有安装的 '点' 图像生成实用程序。xhprof绘制的是png图,绘图的dot拓展没装成功,也就是dot 不支持PNG# yum install -y graphviz 即可
wget http://pecl.php.net/get/xhprof-0.9.4.tgz tar zxvf xhprof-0.9.4.tgz cd xhprof-0.9.4 whereis phpize /usr/bin/phpize
转载于:https://www.cnblogs.com/cyj1733/p/6536472.html
centos6 安装xhprof扩展相关推荐
- php在window下安装xhprof扩展环境说明:
php:php7.3.4nts (phpstudy_pro集成环境中的php) xhprof:php_xhprof-2.2.3-7.3-nts-vc15-x64 window 10 64位 1.同时下 ...
- docker安装php xhprof扩展及使用方法
1. 进入php容器的命令行模式,安装xhprof扩展 # 1. 进入扩展文件目录 cd /usr/src/php/ext# 2. 下载xhprof扩展包 # 注释:https://pecl.php. ...
- linux系统安装xhprof,xhprof扩展安装与使用
一.xhprof扩展安装步骤 xhprof是PHP的一个扩展,最好也直接安装上graphviz图形绘制工具(用于xhprof分析结果以直观的图形方式显示),废话不多说,直奔正题. 1.安装 PHP5版 ...
- window下安装php扩展xhprof
下载扩展包(pecl.php.net/package/xhprof),windows环境需要同时下载DLL的zip和tgz两个包. 因为zip包里没有HTML 的用户界面程序的代码.只有tgz里有. ...
- php7.1安装redis,php7安装redis扩展
当前使用Centos7.x系统,同样适用于Centos6.x,php当前使用7.1版本,wlnmp一键包已支持该扩展 redis扩展包地址:https://pecl.php.net/package/r ...
- centos6 安装 mantisbt-1.2.8 —— (4)在CentOS6.4中安装配置LAMP环境
一.修改设置对安装做准备 1 1. 防火墙设置 2 2. 关闭SELINUX 3 二.开始安装软件 4 1. MySql的安装和配置 4 2. Apache服务的安装和配置 8 3.安装PHP 10 ...
- php7安装xhprof,PHP 7.1安装xhprof进行性能分析的介绍
这篇文章主要介绍了关于PHP 7.1安装xhprof进行性能分析的介绍,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 安装扩展 该 xhprof扩展版本是从 https://githu ...
- php安装redis扩展报错,CentOS 67下php5+安装redis扩展组件
首先去redis官网,点击 clients 链接,在 Browse by language 内点击 PHP 项,以phpredis为例,打开这个扩展扩展组件的链接,到github下载此扩展组件. 下载 ...
- php7 imagick扩展,php7安装imagick扩展
使用php7,通过加载pdf文件,生成图片,需要用到imagick扩展,下面是如何安装该扩展 php使用7.1版本,操作系统为centos6版本 1.首先linux下,通过yum 安装依赖包 yum ...
最新文章
- mysql load data on duplicate_带有ON DUPLICATE KEY UPDATE的MySQL LOAD DATA INFILE
- Python之配置日志模块logging
- 2020元旦快乐!简单粗暴自动化免费文档存储备份方案
- OpenCV图像中的人脸界标检测
- adaboost mh matlab,Adaboost算法的前世今生
- Linux基础-1.0共享文件夹创建
- ajax 浏览器后退,全站Ajax浏览器后退方法
- 随想录(公司程序员的九层楼)
- 机器学习之降维方法(LDA、PCA)小结
- effective_transformer
- CCF201709-1 打酱油(100分)【水题】
- 对Excel或者其他office操作推荐使用NPOI
- 【csdn积分】获得方式大全
- 图片、图标、代码资源网站
- UiLanguage 语言-国家代码表
- 微信最新版下载 8.0.6
- Vue.use 写多个_支付宝为16个行业写的文案,据说价值30万
- 如何从gitbub上clone代码
- 软著申请模板,帮助了不少小伙伴少走弯路
- 维修技术论坛万能预装系统 v5.0