GitHub Actions shivammathur/setup-php "Could not find PHP version"
By Daniel Zoghalchali·Latchkey
setup-php could not provision the requested PHP. The php-version does not exist or is unsupported on the runner OS, or an extension/tool download failed transiently while building the environment.
What this error means
The setup-php step fails resolving the version or installing an extension, and later php/composer steps fail with "command not found". Re-runs succeed when the cause was a transient download.
Actions log
Error: PHP version 8.9 is not supported
# or
Failed to download extension from PECL (transient network error)
Common causes
Unsupported or non-existent php-version
A version like 8.9 that has not shipped, or one not supported on the selected runner OS, cannot be resolved by setup-php.
Transient extension/tool fetch failure
Extensions and tools are downloaded during setup. A brief PECL or package-source outage fails the install even with a valid version.
Pin php-version to a released, supported version for your runner OS.
Re-run when the failure is an extension/tool download error rather than an unsupported-version error.
Trim the extensions list to only what the build needs.
How to prevent it
Pin php-version to a supported release.
Retry transient extension-download failures.
Keep the extensions list minimal.
Frequently asked questions
What causes "setup-php version"?
A version like 8.9 that has not shipped, or one not supported on the selected runner OS, cannot be resolved by setup-php.
How do I fix setup-php version?
Request a supported version
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.