function PhpSubprocess::__construct
Parameters
array $command The command to run and its arguments listed as separate entries. They will automatically: get prefixed with the PHP binary
string|null $cwd The working directory or null to use the working dir of the current PHP process:
array|null $env The environment variables or null to use the same environment as the current PHP process:
int $timeout The timeout in seconds:
array|null $php Path to the PHP binary to use with any additional arguments:
Overrides Process::__construct
File
-
vendor/
symfony/ process/ PhpSubprocess.php, line 54
Class
- PhpSubprocess
- PhpSubprocess runs a PHP command as a subprocess while keeping the original php.ini settings.
Namespace
Symfony\Component\ProcessCode
public function __construct(array $command, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null) {
if (null === $php) {
$executableFinder = new PhpExecutableFinder();
$php = $executableFinder->find(false);
$php = false === $php ? null : array_merge([
$php,
], $executableFinder->findArguments());
}
if (null === $php) {
throw new RuntimeException('Unable to find PHP binary.');
}
$tmpIni = $this->writeTmpIni($this->getAllIniFiles(), sys_get_temp_dir());
$php = array_merge($php, [
'-n',
'-c',
$tmpIni,
]);
register_shutdown_function('unlink', $tmpIni);
$command = array_merge($php, $command);
parent::__construct($command, $cwd, $env, null, $timeout);
}