symfony/process · error · RuntimeException
Unable to create temporary ini file.
Error message
Unable to create temporary ini file.
What it means
Thrown from PhpSubprocess::writeTmpIni when tempnam() fails to create the temporary php.ini file in the system temp dir (called during construction). Without this file the subprocess cannot be configured with the parent's INI settings.
Solutions
- Ensure the system temporary directory exists and is writable
- Check disk space and permissions for the temp directory
- Point sys_get_temp_dir() to a writable location via TMPDIR/TMP/TEMP
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at PhpSubprocess.php:98 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/1be0fa26e33d466d.
Report an issue: GitHub.
Appendix: source
Thrown at PhpSubprocess.php:98
throw new LogicException(\sprintf('The "%s()" method cannot be called when using "%s".', __METHOD__, self::class));
}
/**
* @param (callable('out'|'err', string):void)|null $callback
*/
public function start(?callable $callback = null, array $env = []): void
{
if (null === $this->getCommandLine()) {
throw new RuntimeException('Unable to find the PHP executable.');
}
parent::start($callback, $env);
}
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]);
}View on GitHub (pinned to 99b85026db)