分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

pinpoint支持php

发布时间:2023-09-06 02:14责任编辑:胡小海关键词:暂无标签
环境:
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 http://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 http://172.16.65.85/index.php

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

pinpoint支持php

原文地址:http://blog.51cto.com/firemelon/2175305

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved