What is setup-php?
setup-php is a GitHub Action that provides a cross-platform interface to configure PHP environments in your CI/CD workflows. It supports Ubuntu, Windows, and macOS on both GitHub-hosted and self-hosted runners, and handles the differences between platforms automatically.
With a single step in your workflow, you can:
- Install a specific PHP version (5.3 through 8.6, including nightly builds)
- Add PHP extensions from packages, PECL, or git repositories
- Configure
php.inivalues - Set up code coverage drivers (Xdebug or PCOV)
- Install popular tools like Composer, PHPUnit, PHPStan, and 50+ more
OS/Platform support
Both GitHub-hosted and self-hosted runners are supported on the following operating systems.GitHub-hosted runners
| Virtual environment | Arch | YAML workflow label | Pre-installed PHP |
|---|---|---|---|
| Ubuntu 24.04 | x86_64 | ubuntu-latest or ubuntu-24.04 | PHP 8.3 |
| Ubuntu 22.04 | x86_64 | ubuntu-22.04 | PHP 8.1 |
| Ubuntu 24.04 | aarch64 | ubuntu-24.04-arm | PHP 8.3 |
| Ubuntu 22.04 | aarch64 | ubuntu-22.04-arm | PHP 8.1 |
| Windows Server 2025 | x64 | windows-2025 | PHP 8.5 |
| Windows Server 2022 | x64 | windows-latest or windows-2022 | PHP 8.5 |
| macOS Tahoe 26.x | arm64 | macos-26 | — |
| macOS Sequoia 15.x | arm64 | macos-latest or macos-15 | — |
| macOS Sonoma 14.x | arm64 | macos-14 | — |
| macOS Tahoe 26.x | x86_64 | macos-26-intel | PHP 8.5 |
| macOS Sequoia 15.x | x86_64 | macos-15-intel | PHP 8.5 |
Self-hosted runners
| Host OS/Virtual environment | YAML workflow label |
|---|---|
| Ubuntu 24.04 | self-hosted or Linux |
| Ubuntu 22.04 | self-hosted or Linux |
| Debian 13 | self-hosted or Linux |
| Debian 12 | self-hosted or Linux |
| Debian 11 | self-hosted or Linux |
| Windows 7 and newer | self-hosted or Windows |
| Windows Server 2012 R2 and newer | self-hosted or Windows |
| macOS Tahoe 26.x x86_64/arm64 | self-hosted or macOS |
| macOS Sequoia 15.x x86_64/arm64 | self-hosted or macOS |
| macOS Sonoma 14.x x86_64/arm64 | self-hosted or macOS |
If the requested PHP version is pre-installed on the runner,
setup-php switches to it. Otherwise it installs the requested version. Operating systems based on the supported Ubuntu and Debian versions are also supported on a best-effort basis.PHP version support
setup-php supports PHP 5.3 through 8.6 across all supported platforms, with some variation by runner type.
- GitHub-hosted runners (non-ARM): PHP 5.3 to PHP 8.6
- GitHub-hosted macOS ARM64 (
macos-14): PHP 5.6 to PHP 8.6 - Self-hosted runners: PHP 5.6 to PHP 8.6
| PHP version | Stability | Release support | Runner support |
|---|---|---|---|
5.3 | Stable | End of life | GitHub-hosted |
5.4 | Stable | End of life | GitHub-hosted |
5.5 | Stable | End of life | GitHub-hosted |
5.6 | Stable | End of life | GitHub-hosted, self-hosted |
7.0 | Stable | End of life | GitHub-hosted, self-hosted |
7.1 | Stable | End of life | GitHub-hosted, self-hosted |
7.2 | Stable | End of life | GitHub-hosted, self-hosted |
7.3 | Stable | End of life | GitHub-hosted, self-hosted |
7.4 | Stable | End of life | GitHub-hosted, self-hosted |
8.0 | Stable | End of life | GitHub-hosted, self-hosted |
8.1 | Stable | End of life | GitHub-hosted, self-hosted |
8.2 | Stable | Security fixes only | GitHub-hosted, self-hosted |
8.3 | Stable | Security fixes only | GitHub-hosted, self-hosted |
8.4 | Stable | Active | GitHub-hosted, self-hosted |
8.5 | Stable | Active | GitHub-hosted, self-hosted |
8.6 | Nightly | In development | GitHub-hosted, self-hosted |
Specifying
8.6 in the php-version input installs a nightly build of PHP 8.6.0-dev from the master branch of PHP. These builds may contain bugs and breaking changes.Explore setup-php
Quickstart
Get PHP configured in your GitHub Actions workflow in minutes with a complete working example.
Configuration
Full reference for all inputs, outputs, and environment flags.
Extensions
Install PHP extensions from packages, PECL, or git repositories.
Tools
Set up 50+ PHP tools globally, including PHPUnit, PHPStan, and Composer.