class PhpProcess in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/process/PhpProcess.php \Symfony\Component\Process\PhpProcess
PhpProcess runs a PHP script in an independent process.
$p = new PhpProcess('<?php echo "foo"; ?>'); $p->run(); print $p->getOutput()."\n";
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\Process\Process
- class \Symfony\Component\Process\PhpProcess
Expanded class hierarchy of PhpProcess
2 files declare their use of PhpProcess
- Client.php in vendor/
symfony/ browser-kit/ Client.php - PhpProcessTest.php in vendor/
symfony/ process/ Tests/ PhpProcessTest.php
File
- vendor/
symfony/ process/ PhpProcess.php, line 25
Namespace
Symfony\Component\ProcessView source
class PhpProcess extends Process {
/**
* Constructor.
*
* @param string $script The PHP script to run (as a string)
* @param string|null $cwd The working directory or null to use the working dir of the current PHP process
* @param array|null $env The environment variables or null to use the same environment as the current PHP process
* @param int $timeout The timeout in seconds
* @param array $options An array of options for proc_open
*/
public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array()) {
$executableFinder = new PhpExecutableFinder();
if (false === ($php = $executableFinder
->find())) {
$php = null;
}
parent::__construct($php, $cwd, $env, $script, $timeout, $options);
}
/**
* Sets the path to the PHP binary to use.
*/
public function setPhpBinary($php) {
$this
->setCommandLine($php);
}
/**
* {@inheritdoc}
*/
public function start($callback = null) {
if (null === $this
->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
}
parent::start($callback);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpProcess:: |
public | function | Sets the path to the PHP binary to use. | |
PhpProcess:: |
public | function |
Starts the process and returns after writing the input to STDIN. Overrides Process:: |
|
PhpProcess:: |
public | function |
Constructor. Overrides Process:: |
|
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
public static | property | Exit codes translation table. | |
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | @var PipesInterface | |
Process:: |
private | property | ||
Process:: |
private static | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
private | property | ||
Process:: |
public | function | Adds a line to the STDERR stream. | |
Process:: |
public | function | Adds a line to the STDOUT stream. | |
Process:: |
protected | function | Builds up the callback used by wait(). | |
Process:: |
private | function | Captures the exitcode if mentioned in the process information. | |
Process:: |
public | function | Performs a check between the timeout definition and the time the process started. | |
Process:: |
public | function | Clears the process output. | |
Process:: |
public | function | Clears the process output. | |
Process:: |
private | function | Closes process resource, closes file handles, sets the exitcode. | |
Process:: |
public | function | Disables fetching output and error output from the underlying process. | |
Process:: |
private | function | Sends a POSIX signal to the process. | |
Process:: |
public | function | Enables fetching output and error output from the underlying process. | |
Process:: |
constant | |||
Process:: |
public | function | Gets the command line to be executed. | |
Process:: |
private | function | Creates the descriptors needed by the proc_open. | |
Process:: |
public | function | Returns whether sigchild compatibility mode is activated or not. | |
Process:: |
public | function | Gets whether or not Windows compatibility is enabled. | |
Process:: |
public | function | Gets the environment variables. | |
Process:: |
public | function | Returns the current error output of the process (STDERR). | |
Process:: |
public | function | Returns the exit code returned by the process. | |
Process:: |
public | function | Returns a string representation for the exit code returned by the process. | |
Process:: |
public | function | Gets the process idle timeout (max. time since last output). | |
Process:: |
public | function | Returns the errorOutput incrementally. | |
Process:: |
public | function | Returns the output incrementally. | |
Process:: |
public | function | Gets the Process input. | |
Process:: |
public | function | Gets the options for proc_open. | |
Process:: |
public | function | Returns the current output of the process (STDOUT). | |
Process:: |
public | function | Returns the Pid (process identifier), if applicable. | |
Process:: |
public | function | Gets the process status. | |
Process:: |
public | function | Gets the contents of STDIN. | |
Process:: |
public | function | Returns the number of the signal that caused the child process to stop its execution. | |
Process:: |
public | function | Returns the number of the signal that caused the child process to terminate its execution. | |
Process:: |
public | function | Gets the process timeout (max. runtime). | |
Process:: |
public | function | Gets the working directory. | |
Process:: |
public | function | Returns true if the child process has been terminated by an uncaught signal. | |
Process:: |
public | function | Returns true if the child process has been stopped by a signal. | |
Process:: |
public | function | Returns true in case the output is disabled, false otherwise. | |
Process:: |
public | function | Returns PTY state. | |
Process:: |
public static | function | Returns whether PTY is supported on the current operating system. | |
Process:: |
public | function | Checks if the process is currently running. | |
Process:: |
protected | function | Returns whether PHP has been compiled with the '--enable-sigchild' option or not. | 1 |
Process:: |
public | function | Checks if the process has been started with no regard to the current state. | |
Process:: |
public | function | Checks if the process ended successfully. | |
Process:: |
public | function | Checks if the process is terminated. | |
Process:: |
public | function | Checks if the TTY mode is enabled. | |
Process:: |
public | function | Runs the process. | |
Process:: |
constant | |||
Process:: |
private | function | Reads pipes, executes callback. | |
Process:: |
private | function | Ensures the process is running or terminated, throws a LogicException if the process has a not started. | |
Process:: |
private | function | Ensures the process is terminated, throws a LogicException if the process has a status different than `terminated`. | |
Process:: |
private | function | Resets data related to the latest run of the process. | |
Process:: |
public | function | Restarts the process. | |
Process:: |
public | function | Runs the process. | |
Process:: |
public | function | Sets the command line to be executed. | |
Process:: |
public | function | Activates sigchild compatibility mode. | |
Process:: |
public | function | Sets whether or not Windows compatibility is enabled. | |
Process:: |
public | function | Sets the environment variables. | |
Process:: |
public | function | Sets the process idle timeout (max. time since last output). | |
Process:: |
public | function | Sets the input. | |
Process:: |
public | function | Sets the options for proc_open. | |
Process:: |
public | function | Sets PTY mode. | |
Process:: |
public | function | Sets the contents of STDIN. | |
Process:: |
public | function | Sets the process timeout (max. runtime). | |
Process:: |
public | function | Enables or disables the TTY mode. | |
Process:: |
public | function | Sets the current working directory. | |
Process:: |
public | function | Sends a POSIX signal to the process. | |
Process:: |
constant | |||
Process:: |
constant | |||
Process:: |
constant | |||
Process:: |
constant | |||
Process:: |
constant | |||
Process:: |
constant | |||
Process:: |
public | function | Stops the process. | |
Process:: |
constant | |||
Process:: |
protected | function | Updates the status of the process, reads pipes. | |
Process:: |
private | function | Validates and returns the filtered timeout. | |
Process:: |
public | function | Waits for the process to terminate. | |
Process:: |
public | function | ||
Process:: |
public | function |