Add support for Xdebug Profiler

This commit is contained in:
Dany Maillard 2018-08-28 20:37:40 +02:00
parent ecff692f8e
commit 0f4c0a6eaf
3 changed files with 9 additions and 1 deletions

View File

@ -133,6 +133,9 @@ EOF
$config = new WebServerConfig($documentRoot, $env, $input->getArgument('addressport'), $input->getOption('router'));
$io->success(sprintf('Server listening on http://%s', $config->getAddress()));
if (ini_get('xdebug.profiler_enable_trigger')) {
$io->comment('Xdebug profiler trigger enabled.');
}
$io->comment('Quit the server with CONTROL-C.');
$exitCode = $server->run($config, $disableOutput, $callback);

View File

@ -144,6 +144,9 @@ EOF
if (WebServer::STARTED === $server->start($config, $input->getOption('pidfile'))) {
$io->success(sprintf('Server listening on http://%s', $config->getAddress()));
if (ini_get('xdebug.profiler_enable_trigger')) {
$io->comment('Xdebug profiler trigger enabled.');
}
}
} catch (\Exception $e) {
$io->error($e->getMessage());

View File

@ -150,7 +150,9 @@ class WebServer
throw new \RuntimeException('Unable to find the PHP binary.');
}
$process = new Process(array_merge(array($binary), $finder->findArguments(), array('-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter())));
$xdebugArgs = ini_get('xdebug.profiler_enable_trigger') ? array('-dxdebug.profiler_enable_trigger=1') : array();
$process = new Process(array_merge(array($binary), $finder->findArguments(), $xdebugArgs, array('-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter())));
$process->setWorkingDirectory($config->getDocumentRoot());
$process->setTimeout(null);