Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PhpProcess.php

function PhpProcess::__construct

Parameters

string $script The PHP script to run (as a string):

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/PhpProcess.php, line 35

Class

PhpProcess
PhpProcess runs a PHP script in an independent process.

Namespace

Symfony\Component\Process

Code

public function __construct(string $script, ?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 ('phpdbg' === \PHP_SAPI) {
        $file = tempnam(sys_get_temp_dir(), 'dbg');
        file_put_contents($file, $script);
        register_shutdown_function('unlink', $file);
        $php[] = $file;
        $script = null;
    }
    parent::__construct($php, $cwd, $env, $script, $timeout);
}
RSS feed
Powered by Drupal