Skip to main content
The php-version input controls which PHP version is installed on your runner. setup-php supports PHP 5.3 through 8.6 across GitHub-hosted and self-hosted runners on Ubuntu, Windows, and macOS.

Supported PHP versions

Specifying 8.6 installs a nightly build of PHP 8.6.0-dev from the master branch of PHP. See the nightly build section below for details.

Platform support

GitHub-hosted runners

PHP 5.3–5.5 are only available on GitHub-hosted runners, not self-hosted runners. PHP 5.6–8.6 are supported on both. On GitHub-hosted macOS ARM64 runners (e.g. macos-14), only PHP 5.6 and above are supported.

Self-hosted runners

If the requested PHP version is pre-installed, 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 input options

The php-version input accepts several formats:
Provide a version string such as '8.5' or '8.4':

Auto-detection from project files

When php-version is not specified, setup-php looks for the PHP version in the following order:
  1. The php-version-file input (if provided)
  2. A composer.lock file — reads platform-overrides.php
  3. A composer.json file — reads config.platform.php
If none of these are present, the latest stable PHP version is installed.
If your composer.lock or composer.json is in a subdirectory, set the COMPOSER_PROJECT_DIR environment variable to the subdirectory path.

php-version-file input

Specify a file that contains the PHP version to use. By default, setup-php looks for a .php-version file:
The file must either contain just the PHP version string (e.g. 8.5) or follow the asdf .tool-versions format. If the default .php-version file is not found and php-version-file is not set, the latest stable PHP version is installed.

Special builds

Nightly build

Specifying 8.6 (or nightly) installs a nightly build of PHP 8.6.0-dev compiled from the master branch:
Nightly PHP versions are in active development and may contain bugs or breaking changes. Some user-space extensions may not yet support these versions.

Debug build

Production release builds without debugging symbols are installed by default. Set the debug environment variable to true to install a build with debugging symbols for PHP 5.6 and above:
Debug symbol locations by platform:
  • Linux — debug info files in /usr/lib/debug/.build-id, matching the build-id in the ELF section of PHP binaries
  • Windows — .pdb files in the PHP installation directory
  • macOS — debug symbols compiled directly into the binaries

Thread-safe build

Non-thread-safe (NTS) PHP is installed by default. Use the phpts environment variable to select a thread-safe (TS/ZTS) build:

JIT configuration

PHP 8.0 and above support Just-in-Time (JIT) compilation. To enable JIT:
  • Enable opcache in CLI mode with opcache.enable_cli=1
  • Set coverage: none — JIT conflicts with Xdebug, PCOV, and other extensions that override zend_execute_ex
  • Optionally tune opcache.jit and opcache.jit_buffer_size
By default, when JIT is enabled, setup-php sets opcache.jit=1235 and opcache.jit_buffer_size=256M (128M on ARM).
Enable JIT in tracing mode with a 64 MB buffer:
Refer to the official PHP opcache documentation for a full list of JIT directives and their values.