setPhpBinary() публичный Метод

Sets the path to the PHP binary to use.
public setPhpBinary ( $php )
Пример #1
0
 /**
  * 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
0
    /**
     * 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
0
 /**
  * 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();
 }