symfony/process · error · RuntimeException

Unable to read ini:

Error message

Unable to read ini: 

What it means

Thrown from PhpSubprocess::writeTmpIni when one of the discovered php.ini files cannot be read with file_get_contents (unreadable or removed since discovery). The resulting error message includes the failing file path.

Solutions

  1. Ensure the php.ini files referenced are readable by the current user
  2. Pass an explicit $php/ini setup avoiding inaccessible ini files
  3. Verify permissions on the loaded ini files (php --ini lists them)
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at PhpSubprocess.php:111 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of symfony/process@99b85026db (2026-09-14). Data as JSON: /api/errors/cd6cbb4d050c645e. Report an issue: GitHub.

Appendix: source

Thrown at PhpSubprocess.php:111

    }

    private function writeTmpIni(array $iniFiles, string $tmpDir): string
    {
        if (false === $tmpfile = @tempnam($tmpDir, '')) {
            throw new RuntimeException('Unable to create temporary ini file.');
        }

        // $iniFiles has at least one item and it may be empty
        if ('' === $iniFiles[0]) {
            array_shift($iniFiles);
        }

        $content = '';

        foreach ($iniFiles as $file) {
            // Check for inaccessible ini files
            if (($data = @file_get_contents($file)) === false) {
                throw new RuntimeException('Unable to read ini: '.$file);
            }
            // Check and remove directives after HOST and PATH sections
            if (preg_match('/^\s*\[(?:PATH|HOST)\s*=/mi', $data, $matches, \PREG_OFFSET_CAPTURE)) {
                $data = substr($data, 0, $matches[0][1]);
            }

            $content .= $data."\n";
        }

        // Merge loaded settings into our ini content, if it is valid
        $config = parse_ini_string($content);
        $loaded = ini_get_all(null, false);

        if (false === $config || false === $loaded) {
            throw new RuntimeException('Unable to parse ini data.');
        }

        $content .= $this->mergeLoadedConfig($loaded, $config);

View on GitHub (pinned to 99b85026db)