Sign inSign up

markus621/php-prof

By markus621

Updated over 6 years ago

php with profiler

Image
0

106

markus621/php-prof repository overview

install:

docker pull markus621/php-prof

run:

docker run --rm --name phpprof -it -v /local/dir:/var/www -p 9000-9003:9000-9003 markus621/php-prof

ports:

  • 9000 - php-fpm
  • 9001 - xdebug
  • 9002 - web-server xhprof
  • 9003 - web-server phpinfo

example:

test: http://localhost:9002/demo.php

<?php

xhprof_enable(XHPROF_FLAGS_CPU + XHPROF_FLAGS_MEMORY);

function demo_test()
{
    for ($i = 0; $i <= 100; $i++) {
        random_bytes(20);
    }
}
demo_test();

$xhprof_data = xhprof_disable();

$XHPROF_ROOT = '/tools/xhprof/';
include_once $XHPROF_ROOT . '/xhprof_lib/utils/xhprof_lib.php';
include_once $XHPROF_ROOT . '/xhprof_lib/utils/xhprof_runs.php';

$xhprof_runs = new \XHProfRuns_Default();
$run_id = $xhprof_runs->save_run($xhprof_data, 'xhprof_testing');

echo "http://localhost:9002/index.php?run={$run_id}&source=xhprof_testing";
?>

Tag summary

Content type

Image

Digest

Size

182.7 MB

Last updated

over 6 years ago

docker pull markus621/php-prof:1.0.0