本文整理匯總了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();
}