예제 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (\Helper\System::getEngine() === 'hhvm') {
         $this->getApplication()->find('php:engine')->run(new ArrayInput(array('command' => 'php:engine', 'engine' => 'zend')), $output);
     }
     passthru('phpmanager restore');
 }
예제 #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (\Helper\System::getEngine() === 'hhvm') {
         $output->writeln("<comment>[warning]</comment> Engine is set to <info>hhvm</info>. No changes will be made.");
         $output->writeln("<comment>[warning]</comment> Switch back to the Zend engine if you want to use Xdebug");
         exit;
     }
 }
예제 #3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (\Helper\System::getEngine() === 'hhvm') {
         $output->writeln('<comment>[notice]</comment> You are currently running the HHVM engine');
         $output->writeln('<comment>[notice]</comment> Switch back to the Zend engine to manage Zend PHP versions');
         exit;
     }
     passthru('phpmanager available');
 }
예제 #4
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     `sudo service varnish start 2>&1 1> /dev/null`;
     `sudo service apache2 start 2>&1 1> /dev/null`;
     `sudo service mysql start 2>&1 1> /dev/null`;
     if (\Helper\System::getEngine() === 'hhvm') {
         `sudo service hhvm start  2>&1 1> /dev/null`;
     }
     $output->writeln('Server has been started');
 }
예제 #5
0
 protected function _listIniFiles()
 {
     $bin = \Helper\System::getPHPCommand();
     $filelist = `{$bin} -r 'echo php_ini_scanned_files();'`;
     if (strpos($filelist, ',')) {
         $files = explode(',', $filelist);
         foreach ($files as $file) {
             echo trim($file) . PHP_EOL;
         }
     }
     return false;
 }
예제 #6
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (\Helper\System::getEngine() === 'hhvm') {
         $output->writeln("<comment>[warning]</comment> Engine is set to <info>hhvm</info>. No changes will be made.");
         $output->writeln("<comment>[warning]</comment> Switch back to the Zend engine if you want to use Zend Server Z-Ray");
         exit;
     }
     $version = \Helper\System::getZendPHPVersion();
     $major = substr($version, 0, 3);
     if (!in_array($major, array('5.5', '5.6'))) {
         $output->writeln("<comment>[warning]</comment> <info>Zend Server Z-Ray</info> is only supported on PHP 5.5 and 5.6.");
         $output->writeln("<comment>[warning]</comment> Your current version is PHP {$version}");
         exit;
     }
 }
예제 #7
0
 /**
  * Look up the value for the given ini directive
  * in the currently active PHP version.
  *
  * @param $key
  * @return bool
  */
 public static function getPHPConfig($key)
 {
     $bin = \Helper\System::getPHPCommand();
     // Special case: since we explicitly disable xdebug.profiler_enable on CLI commands
     // we need to omit this when looking up this specific key.
     // Otherwise the result will always be 0
     if ($key == 'xdebug.profiler_enable') {
         $bin = str_replace('-d xdebug.profiler_enable=Off', '', $bin);
     }
     $current = `{$bin} -r "\\\$value = ini_get('{$key}'); echo \\\$value === false ? 'unknown-directive' : \\\$value;"`;
     if ($current == 'unknown-directive') {
         return false;
     }
     return $current;
 }
예제 #8
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $services = $input->getArgument('service');
     if (!count($services)) {
         $services = array('apache2', 'varnish', 'mysql', 'hhvm');
     }
     if (($key = array_search('apache', $services)) !== false) {
         $services[$key] = 'apache2';
     }
     if (($key = array_search('hhvm', $services)) !== false) {
         if (\Helper\System::getEngine() === 'hhvm') {
             `sudo service hhvm restart  2>&1 1> /dev/null`;
         }
         unset($services[$key]);
     }
     foreach ($services as $service) {
         `sudo service {$service} restart 2>&1 1> /dev/null`;
     }
     $output->writeln("Server has been restarted");
 }
예제 #9
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $currentEngine = \Helper\System::getEngine();
     $engine = strtolower($input->getArgument('engine'));
     if (empty($engine)) {
         $output->writeln(sprintf("Current engine is <info>%s</info>!", $currentEngine));
         return;
     }
     if (!in_array($engine, array('zend', 'hhvm'))) {
         throw new \RuntimeException('Unknown engine "' . $engine . '"');
     }
     if ($currentEngine === $engine) {
         $output->writeln(sprintf("<comment>[warning]</comment> Engine is already set to <info>%s</info>!", $engine));
         return;
     }
     switch ($engine) {
         case 'hhvm':
             `sudo a2enconf hhvm`;
             `sudo a2dismod php5`;
             if (file_exists('/etc/apache2/mods-available/php7.conf')) {
                 `sudo a2dismod php7`;
             }
             break;
         case 'zend':
             `sudo a2disconf hhvm`;
             if (version_compare(\Helper\System::getZendPHPVersion(), '7.0.0alpha1', '<')) {
                 $php = 'php5';
             } else {
                 $php = 'php7';
             }
             `sudo a2enmod {$php}`;
             break;
     }
     `sudo service apache2 restart`;
     $output->writeln('Switched engine to <info>' . $engine . '</info>');
 }