{"record":{"id":"1811364a5ff2197e","repo":"symfony/process","slug":"unable-to-find-php-binary","errorCode":null,"errorMessage":"Unable to find PHP binary.","messagePattern":"Unable to find PHP binary\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"PhpSubprocess.php","lineNumber":65,"sourceCode":"{\n    /**\n     * @param array         $command The command to run and its arguments listed as separate entries. They will automatically\n     *                               get prefixed with the PHP binary\n     * @param string|null   $cwd     The working directory or null to use the working dir of the current PHP process\n     * @param EnvArray|null $env     The environment variables or null to use the same environment as the current PHP process\n     * @param int           $timeout The timeout in seconds\n     * @param array|null    $php     Path to the PHP binary to use with any additional arguments\n     */\n    public function __construct(array $command, ?string $cwd = null, ?array $env = null, int $timeout = 60, ?array $php = null)\n    {\n        if (null === $php) {\n            $executableFinder = new PhpExecutableFinder();\n            $php = $executableFinder->find(false);\n            $php = false === $php ? null : array_merge([$php], $executableFinder->findArguments());\n        }\n\n        if (null === $php) {\n            throw new RuntimeException('Unable to find PHP binary.');\n        }\n\n        $tmpIni = $this->writeTmpIni($this->getAllIniFiles(), sys_get_temp_dir());\n\n        $php = array_merge($php, ['-n', '-c', $tmpIni]);\n        register_shutdown_function('unlink', $tmpIni);\n\n        $command = array_merge($php, $command);\n\n        parent::__construct($command, $cwd, $env, null, $timeout);\n    }\n\n    public static function fromShellCommandline(string $command, ?string $cwd = null, ?array $env = null, mixed $input = null, ?float $timeout = 60): static\n    {\n        throw new LogicException(\\sprintf('The \"%s()\" method cannot be called when using \"%s\".', __METHOD__, self::class));\n    }\n\n    /**","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/symfony/process/blob/99b85026db14a68f02c6f3eeb01a1170ca25c491/PhpSubprocess.php#L47-L83","documentation":"The PhpSubprocess constructor must prefix the given command with a PHP binary to run it as a subprocess with the current php.ini settings. When no explicit $php array was passed, it asks PhpExecutableFinder::find() to locate the PHP interpreter; if that search fails (PHP binary not on PATH, or running in an environment without a discoverable PHP CLI executable such as a web SAPI or a stripped container), $php stays null and this RuntimeException is thrown from __construct, so the subprocess can never be started.","triggerScenarios":"Thrown at PhpSubprocess.php:65 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the $php constructor argument with an explicit PHP binary path","Ensure the current PHP runtime exposes a valid PHP_BINARY","Install/locate a PHP CLI binary on the system"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"99b85026db14a68f02c6f3eeb01a1170ca25c491","analyzedAt":"2026-09-14T11:23:33.683Z","contentChangedAt":"2026-09-14T11:23:33.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}