当前位置: 首页>>代码示例>>PHP>>正文


PHP PhpExecutableFinder::find方法代码示例

本文整理汇总了PHP中Symfony\Component\Process\PhpExecutableFinder::find方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpExecutableFinder::find方法的具体用法?PHP PhpExecutableFinder::find怎么用?PHP PhpExecutableFinder::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Process\PhpExecutableFinder的用法示例。


在下文中一共展示了PhpExecutableFinder::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getExecutablePath

 /**
  * @return false|string
  */
 public function getExecutablePath()
 {
     if (null === $this->executablePath) {
         $this->executablePath = $this->executableFinder->find();
     }
     return $this->executablePath;
 }
开发者ID:vukanac,项目名称:PhpSpecExtension,代码行数:10,代码来源:CachingExecutableFinder.php

示例2: find

 /**
  * @see \Symfony\Component\Process\PhpExecutableFinder::find
  */
 public function find($includeArgs = true)
 {
     $php = getenv('ORO_PHP_PATH');
     if ($php && is_executable($php)) {
         return $php;
     }
     return $this->finder->find($includeArgs);
 }
开发者ID:startupz,项目名称:platform-1,代码行数:11,代码来源:PhpExecutableFinder.php

示例3: getPath

 /**
  * @throws \RuntimeException
  *
  * @return string
  */
 public function getPath()
 {
     if (!$this->php_path) {
         if (!($this->php_path = $this->finder->find())) {
             throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again');
         }
         $this->php_path = escapeshellarg($this->php_path);
     }
     return $this->php_path;
 }
开发者ID:anime-db,项目名称:app-bundle,代码行数:15,代码来源:PhpFinder.php

示例4: testFindWithHHVM

 /**
  * tests find() with the env var / constant PHP_BINARY with HHVM.
  */
 public function testFindWithHHVM()
 {
     if (!defined('HHVM_VERSION')) {
         $this->markTestSkipped('Should be executed in HHVM context.');
     }
     $f = new PhpExecutableFinder();
     $current = getenv('PHP_BINARY') ?: PHP_BINARY;
     $this->assertEquals($current . ' --php', $f->find(), '::find() returns the executable PHP');
     $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
 }
开发者ID:saj696,项目名称:pipe,代码行数:13,代码来源:PhpExecutableFinderTest.php

示例5: testFindWithPHP_PEAR_PHP_BIN

 /**
  * tests find() with env var PHP_BINDIR
  */
 public function testFindWithPHP_PEAR_PHP_BIN()
 {
     //TODO the code for suffixes in PHP_BINDIR always catches, so the rest cant be tested
     //maybe remove the code or move the PHP_PEAR_PHP_BIN code above
     $this->markTestIncomplete();
     $f = new PhpExecutableFinder();
     $current = $f->find();
     //not executable PHP_PEAR_PHP_BIN
     putenv('PHP_PEAR_PHP_BIN=/not/executable/php');
     $this->assertFalse($f->find(), '::find() returns false for not executable php');
     //executable PHP_PEAR_PHP_BIN
     putenv('PHP_PEAR_PHP_BIN=' . $current);
     $this->assertEquals($f->find(), $current, '::find() returns the executable php');
 }
开发者ID:hnw,项目名称:symfony,代码行数:17,代码来源:PhpExecutableFinderTest.php

示例6: __construct

 /**
  * Class constructor
  *
  * @param TraceableEventDispatcher $dispatcher
  * @param AntiDogPileMemcache $memcache
  */
 public function __construct(TraceableEventDispatcher $dispatcher, AntiDogPileMemcache $memcache)
 {
     $this->eventDispatcher = $dispatcher;
     $this->memcache = $memcache;
     $phpFinder = new PhpExecutableFinder();
     $this->phpPath = $phpFinder->find();
 }
开发者ID:naroga,项目名称:queue-manager,代码行数:13,代码来源:MemcacheQueue.php

示例7: __construct

 /**
  * Creates a new runner.
  *
  * @param string|null $binDir The path to Composer's "bin-dir".
  */
 public function __construct($binDir = null)
 {
     $phpFinder = new PhpExecutableFinder();
     if (!($php = $phpFinder->find())) {
         throw new RuntimeException('The "php" command could not be found.');
     }
     $puliFinder = new ExecutableFinder();
     // Search:
     // 1. in the current working directory
     // 2. in Composer's "bin-dir"
     // 3. in the system path
     $searchPath = array_merge(array(getcwd()), (array) $binDir);
     // Search "puli.phar" in the PATH and the current directory
     if (!($puli = $puliFinder->find('puli.phar', null, $searchPath))) {
         // Search "puli" in the PATH and Composer's "bin-dir"
         if (!($puli = $puliFinder->find('puli', null, $searchPath))) {
             throw new RuntimeException('The "puli"/"puli.phar" command could not be found.');
         }
     }
     if (Path::hasExtension($puli, '.bat', true)) {
         $this->puli = $puli;
     } else {
         $this->puli = $php . ' ' . $puli;
     }
 }
开发者ID:kormik,项目名称:composer-plugin,代码行数:30,代码来源:PuliRunner.php

示例8: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $learning = $input->hasOption('learning') ? $input->getOption('learning') : false;
     $address = $this->validatePort($input->getArgument('address'));
     $finder = new PhpExecutableFinder();
     if (false === ($binary = $finder->find())) {
         $io->error($this->trans('commands.server.errors.binary'));
         return;
     }
     $router = $this->getRouterPath();
     $cli = sprintf('%s %s %s %s', $binary, '-S', $address, $router);
     if ($learning) {
         $io->commentBlock($cli);
     }
     $io->success(sprintf($this->trans('commands.server.messages.executing'), $binary));
     $processBuilder = new ProcessBuilder(explode(' ', $cli));
     $process = $processBuilder->getProcess();
     $process->setWorkingDirectory($this->appRoot);
     if ('\\' !== DIRECTORY_SEPARATOR && file_exists('/dev/tty') && is_readable('/dev/tty')) {
         $process->setTty('true');
     } else {
         $process->setTimeout(null);
     }
     $process->run();
     if (!$process->isSuccessful()) {
         $io->error($process->getErrorOutput());
     }
 }
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:32,代码来源:ServerCommand.php

示例9: register

 public function register(Application $app)
 {
     $app['task-manager.logger'] = $app->share(function (Application $app) {
         $logger = new $app['monolog.logger.class']('task-manager logger');
         $logger->pushHandler(new NullHandler());
         return $logger;
     });
     $app['task-manager'] = $app->share(function (Application $app) {
         $options = $app['task-manager.listener.options'];
         $manager = TaskManager::create($app['dispatcher'], $app['task-manager.logger'], $app['task-manager.task-list'], ['listener_protocol' => $options['protocol'], 'listener_host' => $options['host'], 'listener_port' => $options['port'], 'tick_period' => 1]);
         $manager->addSubscriber($app['ws.task-manager.broadcaster']);
         return $manager;
     });
     $app['task-manager.logger.configuration'] = $app->share(function (Application $app) {
         $conf = array_replace(['enabled' => true, 'level' => 'INFO', 'max-files' => 10], $app['conf']->get(['main', 'task-manager', 'logger'], []));
         $conf['level'] = defined('Monolog\\Logger::' . $conf['level']) ? constant('Monolog\\Logger::' . $conf['level']) : Logger::INFO;
         return $conf;
     });
     $app['task-manager.task-list'] = $app->share(function (Application $app) {
         $conf = $app['conf']->get(['registry', 'executables', 'php-conf-path']);
         $finder = new PhpExecutableFinder();
         $php = $finder->find();
         return new TaskList($app['EM']->getRepository('Phraseanet:Task'), $app['root.path'], $php, $conf);
     });
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:25,代码来源:TaskManagerServiceProvider.php

示例10: start

 /**
  * @param string $router
  * @param array $env
  * @return UrlScript
  * @throws \RuntimeException
  */
 public function start($router, $env = array())
 {
     $this->slaughter();
     static $port;
     if ($port === NULL) {
         do {
             $port = rand(8000, 10000);
             if (isset($lock)) {
                 @fclose($lock);
             }
             $lock = fopen(dirname(TEMP_DIR) . '/http-server-' . $port . '.lock', 'w');
         } while (!flock($lock, LOCK_EX | LOCK_NB, $wouldBlock) || $wouldBlock);
     }
     $ini = NULL;
     if (($pid = getmypid()) && ($myprocess = `ps -ww -fp {$pid}`)) {
         $fullArgs = preg_split('~[ \\t]+~', explode("\n", $myprocess)[1], 8)[7];
         if (preg_match('~\\s\\-c\\s(?P<ini>[^ \\t]+)\\s~i', $fullArgs, $m)) {
             $ini = '-c ' . $m['ini'] . ' -n';
         }
     }
     $executable = new PhpExecutableFinder();
     $cmd = sprintf('%s %s -d register_argc_argv=on -t %s -S %s:%d %s', escapeshellcmd($executable->find()), $ini, escapeshellarg(dirname($router)), $ip = '127.0.0.1', $port, escapeshellarg($router));
     if (!is_resource($this->process = proc_open($cmd, self::$spec, $this->pipes, dirname($router), $env))) {
         throw new HttpServerException("Could not execute: `{$cmd}`");
     }
     sleep(1);
     // give him some time to boot up
     $status = proc_get_status($this->process);
     if (!$status['running']) {
         throw new HttpServerException("Failed to start php server: " . stream_get_contents($this->pipes[2]));
     }
     $this->url = new UrlScript('http://' . $ip . ':' . $port);
     return $this->getUrl();
 }
开发者ID:kdyby,项目名称:selenium,代码行数:40,代码来源:HttpServer.php

示例11: register

 public function register(Application $app)
 {
     $app['plugins.import-strategy'] = $app->share(function (Application $app) {
         return new ImportStrategy();
     });
     $app['plugins.autoloader-generator'] = $app->share(function (Application $app) {
         return new AutoloaderGenerator($app['plugin.path']);
     });
     $app['plugins.assets-manager'] = $app->share(function (Application $app) {
         return new AssetsManager($app['filesystem'], $app['plugin.path'], $app['root.path']);
     });
     $app['plugins.composer-installer'] = $app->share(function (Application $app) {
         $phpBinary = $app['conf']->get(['main', 'binaries', 'php_binary'], null);
         if (!is_executable($phpBinary)) {
             $finder = new PhpExecutableFinder();
             $phpBinary = $finder->find();
         }
         return new ComposerInstaller($app['composer-setup'], $app['plugin.path'], $phpBinary);
     });
     $app['plugins.explorer'] = $app->share(function (Application $app) {
         return new PluginsExplorer($app['plugin.path']);
     });
     $app['plugins.importer'] = $app->share(function (Application $app) {
         return new Importer($app['plugins.import-strategy'], ['plugins.importer.folder-importer' => $app['plugins.importer.folder-importer']]);
     });
     $app['plugins.importer.folder-importer'] = $app->share(function (Application $app) {
         return new FolderImporter($app['filesystem']);
     });
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:29,代码来源:PluginServiceProvider.php

示例12: __construct

 /**
  * Constructor.
  *
  * @param string $environment
  * @param $consoleDir
  */
 public function __construct($consoleDir, $environment)
 {
     $this->consoleDir = $consoleDir;
     $this->environment = $environment;
     $finder = new PhpExecutableFinder();
     $this->phpExecutable = $finder->find();
 }
开发者ID:dpk125,项目名称:JobQueue,代码行数:13,代码来源:CommandBuilder.php

示例13: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     $learning = $input->hasOption('learning') ? $input->getOption('learning') : false;
     $address = $input->getArgument('address');
     if (false === strpos($address, ':')) {
         $address = sprintf('%s:8088', $address);
     }
     $finder = new PhpExecutableFinder();
     if (false === ($binary = $finder->find())) {
         $io->error($this->trans('commands.server.errors.binary'));
         return;
     }
     $router = $this->getRouterPath();
     $cli = sprintf('%s %s %s %s', $binary, '-S', $address, $router);
     if ($learning) {
         $io->commentBlock($cli);
     }
     $io->success(sprintf($this->trans('commands.server.messages.executing'), $binary));
     $processBuilder = new ProcessBuilder(explode(' ', $cli));
     $process = $processBuilder->getProcess();
     $process->setWorkingDirectory($this->get('site')->getRoot());
     $process->setTty('true');
     $process->run();
     if (!$process->isSuccessful()) {
         $io->error($process->getErrorOutput());
     }
 }
开发者ID:mnico,项目名称:DrupalConsole,代码行数:31,代码来源:ServerCommand.php

示例14: createHostname

 /**
  * @param string $hostname The hostname to register
  */
 public function createHostname($hostname)
 {
     $content = file_get_contents($this->file);
     $lines = explode("\n", $content);
     $matchHostLine = $this->findLine($lines, function ($ip, $hostnames) use($hostname) {
         return in_array($hostname, $hostnames);
     });
     if ($matchHostLine) {
         return;
     }
     $f = new PhpExecutableFinder();
     $php = $f->find();
     if (!$php) {
         throw new \RuntimeException("Failed to determine PHP interpreter");
     }
     $scriptFile = tempnam(sys_get_temp_dir(), 'fix-hosts-php-');
     file_put_contents($scriptFile, "<?php\n" . $this->createScript($content, $lines, $hostname));
     if ($this->isSudo()) {
         echo "Register host \"{$hostname}\" ({$this->ip}) in \"{$this->file}\" via helper \"{$scriptFile}\".\n";
         passthru("sudo  " . escapeshellarg($php) . " " . escapeshellarg($scriptFile), $return);
     } else {
         passthru(escapeshellcmd($php) . " " . escapeshellarg($scriptFile), $return);
     }
     if ($return) {
         throw new \RuntimeException("Failed to update hosts file ({$this->file}) with ({$this->ip} {$hostname}) [{$scriptFile}]");
     }
     unlink($scriptFile);
 }
开发者ID:totten,项目名称:amp,代码行数:31,代码来源:HostsFile.php

示例15: start

 /**
  * Starts the server
  *
  * @param array $options
  * @return void
  */
 public function start(array $options)
 {
     $verbose = isset($options['verbose']) && $options['verbose'];
     if ($this->checkServer()) {
         $this->output->writeln("<error>Queue Manager is already running.</error>");
         return;
     }
     if ($verbose) {
         $this->output->writeln("<info>Queue Manager is starting.</info>");
     }
     $phpFinder = new PhpExecutableFinder();
     $phpPath = $phpFinder->find();
     if ($options['daemon']) {
         $command = $phpPath . ' app/console naroga:queue:start ' . ($verbose ? '-v' : '') . ' &';
         $app = new Process($command);
         $app->setTimeout(0);
         $app->start();
         $pid = $app->getPid();
         $this->memcache->replace('queue.lock', $pid);
         if ($verbose) {
             $this->output->writeln('<info>Queue Manager started with PID = ' . ($pid + 1) . '.</info>');
         }
         return;
     }
     $this->registerListeners($verbose);
     if ($verbose) {
         $pid = $this->memcache->get('queue.lock');
         $this->output->writeln('<info>Queue Manager started with PID = ' . $pid . '.</info>');
     }
     $this->resetServerConfig($options);
     $this->processQueue($options);
 }
开发者ID:naroga,项目名称:queue-manager,代码行数:38,代码来源:Manager.php


注:本文中的Symfony\Component\Process\PhpExecutableFinder::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。