示例#1
0
 /**
  * Loop over all installed PHP versions and find
  * the given base names. Will return a list of
  * absolute paths to the ini files.
  *
  * @param array $basenames array Array of ini file names to look for.
  * @param boolean $global If set to the false, the method will only look for the given ini in the currently enabled PHP version
  * @return array  List of absolute paths
  */
 public static function findIniFiles($basenames = array(), $global = true)
 {
     $inis = array();
     if ($global === false) {
         $version = \Helper\System::getZendPHPVersion();
         if (file_exists("/opt/php/php-{$version}/etc/conf.d")) {
             $paths = array("/opt/php/php-{$version}/etc/conf.d");
         } else {
             $paths = array('/etc/php5/mods-available/');
         }
     } else {
         $paths = array('/etc/php5/mods-available/');
         $installs = glob('/opt/php/php-*/etc/conf.d', GLOB_ONLYDIR);
         $installs = array_unique(array_filter($installs));
         $paths = array_merge($paths, $installs);
     }
     foreach ($paths as $path) {
         foreach ($basenames as $basename) {
             $fullpath = $path . '/' . $basename;
             if (file_exists($fullpath)) {
                 $inis[] = $fullpath;
             }
         }
     }
     return $inis;
 }
示例#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 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;
     }
 }
示例#3
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>');
 }