本文整理汇总了PHP中Symfony\Component\Process\PhpProcess::setPhpBinary方法的典型用法代码示例。如果您正苦于以下问题:PHP PhpProcess::setPhpBinary方法的具体用法?PHP PhpProcess::setPhpBinary怎么用?PHP PhpProcess::setPhpBinary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\Process\PhpProcess
的用法示例。
在下文中一共展示了PhpProcess::setPhpBinary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createProcess
/**
* Create process
*/
protected function createProcess()
{
// initialisation du process
$this->process = new PhpProcess($this->getScript(), $this->getConfiguration()->getCwd(), $this->getConfiguration()->getEnv(), $this->getConfiguration()->getTimeout());
if ($this->configuration->getParameter('PHP_BINARY')) {
$this->process->setPhpBinary($this->configuration->getParameter('PHP_BINARY'));
}
}
示例2: createAndRun
/**
* Initiates new actor in a new PHP process
* @param integer $id An unique id of an actor, should be free tcp-port in current implementation
* @param callable $handler
* @return PhpProcess
*/
public static function createAndRun($id, callable $handler)
{
$serializedHandler = base64_encode((new Serializer())->serialize($handler));
$autoloadPath = Utils::getAutoloadPath();
$process = new PhpProcess(<<<EOF
<?php
require '{$autoloadPath}';
\\Phactor\\Phactor\\Actor::initializeChild({$id}, '{$serializedHandler}');
?>
EOF
);
if (null === $process->getCommandLine()) {
$process->setPhpBinary(PHP_BINARY);
}
// workaround for portable windows php
$process->start();
return $process;
}
示例3: doRequestInProcess
/**
* Makes a request in another process.
*
* @param object $request An origin request instance
*
* @return object An origin response instance
*
* @throws \RuntimeException When processing returns exit code
* @see \Symfony\Component\BrowserKit\Client
* @see \Symfony\Component\HttpKernel\Client
*/
protected function doRequestInProcess($request)
{
// We set the TMPDIR (for Macs) and TEMP (for Windows), because on these platforms the temp directory changes based on the user.
$process = new PhpProcess($this->getScript($request), $this->rootDir, array('TMPDIR' => sys_get_temp_dir(), 'TEMP' => sys_get_temp_dir()));
$process->setPhpBinary('php-cgi');
$process->run();
// I think the second hcheck validates that the response is serialized, but that's not what we want here.
//if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) {
if (!$process->isSuccessful()) {
throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s', $process->getOutput(), $process->getErrorOutput()));
}
return $process->getOutput();
}