diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
index 1d01e04c1296e..88de4a0a2dda7 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
@@ -92,6 +92,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf("Server running on %s\n", $input->getArgument('address')));
+ if (defined('HHVM_VERSION')) {
+ $this->executeWithHHVM($input, $output, $env);
+ return;
+ }
+
$builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
$builder->setWorkingDirectory($input->getOption('docroot'));
$builder->setTimeout(null);
@@ -101,4 +106,65 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
});
}
+
+ protected function executeWithHHVM(InputInterface $input, OutputInterface $output, $env)
+ {
+ list($ip, $port) = explode(':', $input->getArgument('address'));
+ $output->writeln(sprintf("Server(with HHVM) running on $ip:$port\n", $ip, $port));
+ $docroot = realpath($input->getOption('docroot'));
+ $bootstrap = ('prod' === $env ? 'app.php' : 'app_dev.php');
+ $config = <<getContainer()->get('kernel')->getCacheDir().DIRECTORY_SEPARATOR.'hhvm-server-'.md5($config).'.hdf';
+ file_put_contents($tmpfile, $config);
+ $builder = new ProcessBuilder(array(PHP_BINARY, '-ms', "-c$tmpfile"));
+ $builder->setWorkingDirectory($docroot);
+ $builder->setTimeout(null);
+ $builder->getProcess()->run(function ($type, $buffer) use ($output) {
+ if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
+ $output->write($buffer);
+ }
+ });
+ }
+
}