laravel-xhprof
laravel-xhprof copied to clipboard
How do you use this package?
Subject. :point_up: :smiley:
What does it do? How do you enable it? Does it have a built-in viewer/client?
Hello.
What does it do? How do you enable it?
- Install the extension and enable it: https://github.com/longxinH/xhprof
- Install the package and the logs are collected.
Does it have a built-in viewer/client?
- I am using this: https://github.com/longxinH/xhprof/tree/master/xhprof_html
бля ну неужели так тяжело написать нахуй инструкцию по пользованию
@er361 Hello. There are no instructions. Install the package and install extension xhprof on the server. Everything works out of the box.
--
Привет. Вся инструкция сводится к composer req bavix/laravel-xhprof
и установке xhprof. Всё работает из коробки.
У меня не заработал этот пакет из коробки. Я установил расширение на сервер, настроил папку для хранения временных файлов. Временные файлы журнала не появляются, плюс ко всему непонятно как управлять данным расширением, как к примеру отключать или включать профилирование при надобности. Я заметил что Srvice Provider не интегрируется самостоятельно в app.php, но даже после ручного добавления провайдера, я не заметил чтобы пакет заработал. Ещё в коде пакета я увидел конфиг, а это означает, что какие-то настройки он всё же имеет, так может всё же, стоит описать более собранный путь того как на голом сервере с установленной Laravel использовать данный пакет?
Я использую: Debian 9 Laravel 5.8 Xhprof 2.2
Ранее я неоднократно использовал Xhprof на текущем и других проектах, добавляя захват в index.php, но это не самый удобный способ из возможных. Я пока попробую поискать похожие пакеты.
@emil-nasso @er361
How I configured this package to work:
PHP 7.2 (this for my old project) Debian 9 Nginx Laravel 5.8 Xhprof 2.2
-
Install xhprof extension for PHP:
pecl install xhprof
-
Add in php.ini or other included config (xhprof.ini):
extension=xhprof.so
xhprof.output_dir=/tmp/xhprof
-
Restart PHP:
sudo systemctl restart fp2-php72-fpm.service
-
Check XHProf in PHP Info:
php -i | grep xhprof
Result:
/opt/php72/conf.d/xhprof.ini,
xhprof
xhprof support => enabled
xhprof.collect_additional_info => 0 => 0
xhprof.output_dir => /tmp/xhprof => /tmp/xhprof
xhprof.sampling_depth => 2147483647 => 2147483647
xhprof.sampling_interval => 100000 => 100000
-
Add domain for view results profiling (xhprof.domain.ru).
-
Download library for view:
cd /var/www/xhprof.domain.ru;
wget http://pecl.php.net/get/xhprof-0.9.4.tgz
gzip -d xhprof-0.9.4.tgz
tar -xvf xhprof-0.9.4.tar
-
Change root path in Nginx config for this domain:
set $root_path /var/www/xhprof.domain.ru/xhprof-0.9.4/xhprof_html;
-
Install this package:
composer req bavix/laravel-xhprof --dev
-
Create config xhprof.php to Laravel in 'app' dir (if empty):
<?php
return [
'path' => base_path('../xhprof.domain.ru/xhprof-0.9.4'),
'enabled' => true,
'freq' => 1
];
- Reload page Laravel site and go to xhprof.domain.ru
Enjoy!
@wdda Thanks for the detailed instructions, I'll add it to the readme over the weekend. Or you can make a pull request.
添加补充,cli模式下不可:
config/xhprof.php
<?php
return [
'path' => base_path('../xhprof.domain.ru/xhprof-0.9.4'),
'enabled' => true,
'freq' => 1,
'flags' => XHPROF_FLAGS_MEMORY | XHPROF_FLAGS_CPU,
'output_dir' => '/tmp/xhprof',
'run_id' => date('YmdHis') . uniqid(),
];
@rez1dent3 @wdda @shencw Still not working i followed the exact same docs. I believe we will have register the service provider first. So how to make it work ?
I figured it out
You need to addd \Bavix\XHProf\XHProfServiceProvider::class
in /config/app.php
@rez1dent3 On Packagist the pakcages is still showing 2.0.0 so how do i composer require bavix/laravel-xhprof
the latest package which is 2.0.1 ?
https://packagist.org/packages/bavix/laravel-xhprof
@khanakia Updated forcibly