PHP语言学习之pinpoint支持php
小标 2019-04-03 来源 : 阅读 1957 评论 0

摘要:本文主要向大家介绍了PHP语言学习之pinpoint支持php,通过具体的内容向大家展示,希望对大家学习php语言有所帮助。

本文主要向大家介绍了PHP语言学习之pinpoint支持php,通过具体的内容向大家展示,希望对大家学习php语言有所帮助。

PHP语言学习之pinpoint支持php

环境:
centos7
pinpoint1.7.3(服务端)
php7.1
gcc4.8.5


1、安装依赖包
yum install automake libtool flex bison pkgconfig gcc-c++


2、下载pinpoint-c-agent源码包
git clone //github.com/naver/pinpoint-c-agent.git


3、执行编译脚本
cd ./pinpoint-c-agent/pinpoint_php
./Build.sh
等待编译结果
...failed updating 56 targets...
...skipped 6 targets...
...updated 14483 targets...
出现如上结果编译结束


4、设置环境变量
export LD_LIBRARY_PATH=$PWD/../thirdlibray/var/:$LD_LIBRARY_PATH


5、phpize


6、再执行编译脚本
./Build.sh


报错:fatal error: openssl/opensslv.h: No such file or directory
解决:yum install openssl-devel


报错:configure: error: Cannot find php-config. Please use --with-php-config=PATH
解决:在Build.sh脚本的build_agent函数里./configure后边加上--w
ith-php-config=/opt/remi/php71/root/usr/bin/php-config(php-config文件所在路径)


重新编译
Build complete.
Don‘t forget to run ‘make test‘.
直到看到如上结果编译完成


7、make install
执行结果Installing shared extensions:会显示pinpoint.so的安装路径


8、配置文件
/etc/pinpoint_agent.conf可参考./pinpoint-c-agent/quickstart/config/pinpoint_agent.conf.example
其中:AgentID、ApplicationName、Collector、LogFileRootPath根据自己情况写
PluginRootDir为php代码目录下边的pinpoint_plugins目录所在路径(需把./pinpoint-c-agent/quickstart/php/web/plugins目录下的文件拷贝到php代码所在目录的pinpoint_plugins目录下)


cat php71_PATH/php.d/pinpoint.ini
[pinpoint]
extension=/opt/remi/php71/root/usr/lib64/php/modules/pinpoint.so
pinpoint_agent.config_full_name=/etc/pinpoint_agent.conf
此配置文件指定模块文件所在路径和agent配置文件所在路径


php -m |grep pinpoint
查看是否报错
报错:open /workspace/logs/webapps/pinpoint_log.txt failed : No such file or directory
解决:创建日志目录即可


报错:PHP Parse error:  syntax error, unexpected ‘;‘, expecting ‘,‘ or ‘)‘ in /workspace/webapps/pinpoint_plugins/curl_plugin.php
解决:拷贝https://github.com/naver/pinpoint-c-agent.git 代码里最新tag的quickstart/php/web/plugins/curl_plugin.php文件替换/workspace/webapps/pinpoint_plugins/curl_plugin.php


9、简单测试
用ab工具请求了2w次web服务
ab -c 10 -n 20000 //172.16.65.85/index.php


可看到监控Application list里出现了刚才添加的testphp71-demo并且收到了刚才模拟请求的数据

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标编程语言PHP频道!


本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程