推荐阅读Tideways、xhprof和xhgui搭建PHP非侵入式监控平台设计模式全面介绍(45种)design-patterns-for-humans中文版MongoDB资源、库、工具、应用选择列表中文版有什么新鲜事鲜为人知,但有趣的网站?一篇攻城狮笔记,每天收集Github上的优秀项目。一些有趣的民间故事。超好用的谷歌浏览器、SublimeText、Phpstorm、油猴插件合集环境。安装前,请确保您已正确安装以下软件。PHPNginxMongodb安装PHPmongodbExtensions$sudopeclinstallmongodb在PHP配置文件中添加[mongodb]extension=mongodb.so安装PHPtideawaysExtension正则编译安装$gitclonehttps://github.com/tideways/php-xhprof-extension.git$cd/path/php-xhprof-extension$phpize$./configure$make$sudomakeinstallPHP在PHP配置文件中添加[tideways]extension=tideways_xhprof.so;不需要自动加载,在程序中控制即可tideways.auto_prepend_library=0;设置频率为100,调用程序时修改tideways.sample_rate=100安装xhgui-branch(xhgui中文版)$gitclonehttps://github.com/laynefyc/xhgui-branch.git$cdxhgui-branch$phpinstall.php修改xhgui-branch配置文件'tideways_xhprof',...'save.handler'=>'mongodb','db.host'=>'mongodb://127.0.0.1:27017','db.db'=>'xhprof',...);启动mongodb并设置xhgui索引,命令如下:$mongo>usexhprof>db.results.ensureIndex({'meta.SERVER.REQUEST_TIME':-1})>db.results.ensureIndex({'profile.main().wt':-1})>db.results.ensureIndex({'profile.main().mu':-1})>db.results.ensureIndex({'profile.main().cpu':-1})>db.results.ensureIndex({'meta.url':1})xhgui本地虚拟主机配置参考服务器{listen80;服务器名称xhgui.test;root/Users/yaozm/Documents/wwwroot/xhgui-branch/webroot;#访问日志/usr/local/var/log/nginx/access.log;error_log/usr/local/var/log/nginx/error.log;位置/{try_files$uri$uri//index.php?$query_string;indexindex.phpindex.htmlindex.htm;}}设置待分析站点,直接在待分析站点的nginx配置中添加如下项,然后使配置生效。$fastcgi_paramPHP_VALUE"auto_prepend_file=/path/xhgui-branch/external/header.php";参考配置server{listen80;服务器名称laravel.test;根/Users/yaozm/Documents/wwwroot/laravel/公共;#访问日志/usr/local/var/log/nginx/access.log;error_log/usr/local/var/log/nginx/error.log;location/{try_files$uri$uri//index.php?$query_string;indexindex.phpindex.htmlindex.htm;}#添加PHP_VALUE告诉PHP程序调用服务fastcgi_paramPHP_VALUE"auto_prepend_file=/path/wwwroot/xhgui-branch/external/header.php";}或者修改PHP配置文件告诉PHP程序调用服务在执行前打电话;在PHP文档之前自动添加文件。;http://php.net/auto-prepend-fileauto_prepend_file="/path/wwwroot/xhgui-branch/external/header.php"参考链接https://github.com/phacility/xhprofhttps://github.com/perftools/xhguihttps://github.com/tideways/php-xhprof-extensionhttps://github.com/laynefyc/xhgui-branchhttps://blog.it2048.cn/article-tideways-xhguihttps://zhuanlan.zhihu。com/p/30832165
