您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)Tideways、xhprof 和 xhgui 如何打造 PHP 非侵入式監(jiān)控平臺(tái),小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話(huà)不多說(shuō),跟著小編一起來(lái)看看吧。
安裝之前確保已經(jīng)正確安裝了以下軟件
$ sudo pecl install mongodb
PHP 配置文件中添加
[mongodb] extension=mongodb.so
常規(guī)編譯安裝
$ git clone https://github.com/tideways/php-xhprof-extension.git $ cd /path/php-xhprof-extension $ phpize $ ./configure $ make $ sudo make install
PHP 配置文件中添加
[tideways] extension=tideways_xhprof.so ; 不需要自動(dòng)加載,在程序中控制就行 tideways.auto_prepend_library=0 ; 頻率設(shè)置為100,在程序調(diào)用時(shí)可以修改 tideways.sample_rate=100
$ git clone https://github.com/laynefyc/xhgui-branch.git $ cd xhgui-branch $ php install.php
修改 xhgui-branch 配置文件
<?php return array( ... 'extension' => 'tideways_xhprof', ... 'save.handler' => 'mongodb', 'db.host' => 'mongodb://127.0.0.1:27017', 'db.db' => 'xhprof', ... );
$ mongo > use xhprof > 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 } )
server { listen 80; server_name xhgui.test; root /Users/yaozm/Documents/wwwroot/xhgui-branch/webroot; # access_log /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; index index.php index.html index.htm; } }
$ fastcgi_param PHP_VALUE "auto_prepend_file=/path/xhgui-branch/external/header.php";
參考配置
server { listen 80; server_name laravel.test; root /Users/yaozm/Documents/wwwroot/laravel/public; # access_log /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; index index.php index.html index.htm; } # 添加 PHP_VALUE,告訴 PHP 程序在執(zhí)行前要調(diào)用的服務(wù) fastcgi_param PHP_VALUE "auto_prepend_file=/path/wwwroot/xhgui-branch/external/header.php"; }
; Automatically add files before PHP document. ; http://php.net/auto-prepend-file auto_prepend_file = "/path/wwwroot/xhgui-branch/external/header.php"
以上就是Tideways、xhprof 和 xhgui 如何打造 PHP 非侵入式監(jiān)控平臺(tái),小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。