symfony/process · warning · RuntimeException

This PHP has been compiled with --enable-sigchild. Term…

Error message

This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.

What it means

getTermSignal() throws this RuntimeException when PHP was compiled with --enable-sigchild. In that configuration the operating system does not expose the child's termination signal to PHP, so the termsig value stays at -1 and cannot be reported. The library surfaces this platform limitation instead of returning a wrong signal.

Solutions

  1. Check isSigchildEnabled() before calling getTermSignal() and skip signal inspection on sigchild builds.
  2. Rely on getExitCode()/isSuccessful() instead of term signal when possible.
  3. Rebuild/choose a PHP without --enable-sigchild if signal information is required.
  4. Wrap getTermSignal() in try-catch for RuntimeException and degrade gracefully.

Example fix

// before
$signal = $process->getTermSignal(); // RuntimeException on sigchild PHP

// after
$signal = \Symfony\Component\Process\Process::isSigchildEnabled() ? null : $process->getTermSignal();
Defensive patterns

Strategy: try-catch

Validate before calling

$sigchild = \Symfony\Component\Process\Process::isSigchildEnabled();
if (!$sigchild && $process->isTerminated()) {
    $signal = $process->getTermSignal();
}

Try / catch

try {
    $signal = $process->getTermSignal();
} catch (\RuntimeException $e) {
    $signal = null; // sigchild PHP: term signal unavailable
}

Prevention

When it happens

Trigger: Calling getTermSignal() after the process terminated on a PHP built with --enable-sigchild, when processInformation['termsig'] is still -1.

Common situations: Older or custom-compiled PHP on exotic systems (historically HP-UX); Docker images built with sigchild-enabled PHP; code that inspects exit signals (e.g., detecting SIGKILL) which works on normal PHP but fails in such environments.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at Process.php:861

        $this->requireProcessIsTerminated(__FUNCTION__);

        return $this->processInformation['signaled'];
    }

    /**
     * Returns the number of the signal that caused the child process to terminate its execution.
     *
     * It is only meaningful if hasBeenSignaled() returns true.
     *
     * @throws RuntimeException In case --enable-sigchild is activated
     * @throws LogicException   In case the process is not terminated
     */
    public function getTermSignal(): int
    {
        $this->requireProcessIsTerminated(__FUNCTION__);

        if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {
            throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.');
        }

        return $this->processInformation['termsig'];
    }

    /**
     * Returns true if the child process has been stopped by a signal.
     *
     * It always returns false on Windows.
     *
     * @throws LogicException In case the process is not terminated
     */
    public function hasBeenStopped(): bool
    {
        $this->requireProcessIsTerminated(__FUNCTION__);

        return $this->processInformation['stopped'];
    }

View on GitHub (pinned to 99b85026db)