setup-php supports a set of environment flags that control how the action behaves. Set them using the env: keyword on the setup-php step.
Workflow flags
When set to
true, the workflow fails immediately if an extension or tool cannot be set up, instead of continuing with a warning in the logs.By default, failures to add or disable extensions and failures to install tools (other than composer) produce a log warning without interrupting the workflow.Controls whether to set up a thread-safe (TS/ZTS) or non-thread-safe (NTS) build of PHP.
| Value | Behavior |
|---|---|
nts | Non-thread-safe build (default) |
ts or zts | Thread-safe build |
When set to You can combine this with
true, updates the pre-installed PHP version on the runner to the latest patch release before setting up.By default, pre-installed PHP versions are not updated to their latest patch. Set this flag when you need the latest bug fixes and security patches for a given minor version.php-version: pre-installed to update whichever PHP version is already installed on the runner:When set to
true, sets up a PHP build that includes debugging symbols. Supported for PHP 5.6 and above.Platform-specific behavior:- Linux — Debug symbols are added as separate debug info files under
/usr/lib/debug/.build-id. Tools likegdbresolve them automatically. - Windows — Debug symbols are added as
.pdbfiles in the PHP installation directory. - macOS — Debug symbols are compiled into the binaries.
Set to
self-hosted when running on a self-hosted runner. This tells setup-php to adjust its behavior for non-GitHub-hosted environments.Composer flags
A comma-separated list of Composer plugin package names to add to the allow list.By default, Composer blocks all plugins. Plugins installed via the
tools input are automatically allowed. Use this flag to allow plugins that are required by your dependencies rather than installed directly.Authentication token for Private Packagist. Set this when your workflow installs private Composer dependencies hosted on Private Packagist.
A JSON string containing Composer authentication credentials for private repositories not hosted on GitHub or Private Packagist. Follows the same format as Composer’s
auth.json.Overrides the Composer process timeout (in seconds). By default,
setup-php sets this to 0 (no timeout), so Composer commands in your scripts do not time out.Set this to a positive integer if you want to enforce a timeout limit on Composer operations.