How to install PHP on Windows using Winget

Published On26 Dec 2024

How to install PHP on Windows using Winget Winget, the Windows command-line tool to search, install, update, and remove Windows applications, now includes support for PHP. Using the CLI winget tool, it is now possible to install PHP along with dependencies with a single command.

This article explains how to search, download, install, update, and remove Windows PHP binaries using winget. PHP packages are installed as portable applications that support modifying the system PATH variable, and require Winget to support Winget manifest 1.9.0 or later.

Winget is installed by default on the latest Windows 11 and Windows Server 2025 versions. If Winget is now already installed, see the Microsoft documentation on Winget.

Windows PHP binaries are sourced from windows.php.net. Winget package manifests include information about the latest versions, their SHA-256 checksums, and the download links for x64 and x86 systems. All of the downloads will be Thread-Safe builds. At the moment, Arm64 builds are not available.

The PHP packages are installed as portable apps, supporting multiple PHP versions simultaneously.

The PHP packages are in the PHP.PHP namespace, followed by the major and minor version numbers of the PHP release. For example, PHP 8.4 is available under the package ID PHP.PHP.8.4. Alternately, the same package is also available under the php8.4 moniker, following the naming pattern used by Debian/Ubuntu PHP packages.

All Windows PHP builds are under the PHP.PHP namespace, and the full package ID is constructed by appending the PHP releases's major and minor version number to the namespace.

For example, PHP 8.4 is named PHP.PHP.8.4.

To search for all PHP packages, run:

winget search PHP.PHP

winget search for PHP.PHP
`winget search PHP.PHP` shows all available PHP packages and their latest versions.

This is comparable to running apt search php or dnf search php on Linux distros such as Debian and RHEL or their derivatives.


To view information about a specific PHP package, winget show PHP.PHP.%VERSION%.

For example, to view information about PHP 8.4 Windows builds, run PHP.PHP.8.4:

winget show PHP.PHP.8.4

winget show PHP.PHP
`winget show PHP.PHP.4` shows all available information about the `PHP.PHP.8.4` package

Alternately, it is also possible to run winget show php8.4 for the same result.

Download PHP Windows Packages

winget allows downloading the ZIP files containing Windows PHP packages directly from windows.php.net. The download is verified against the SHA-256 checksum contained in the manifest to make sure it is not tampered with in transit.

To download the Windows PHP build for a given PHP version, run winget download followed by the PHP version.

For example, to download PHP 8.4 to the current directory, run:

 winget download php8.4 --skip-dependencies -d .

winget download PHP.PHP.8.4
`winget download php8.4` downloads the zip file for the current CPU architecture to the current working directory

  • --skip-dependencies skips downloading Microsoft Visual C++ package that PHP depends on.
  • -d . specifies the download directory, and in this case, sets to the current working directory.

It downloads Thread-Safe builds of PHP for the CPU architecture the command is run on.

Downloading a package does not modify anything else on the system. The difference between download and install commands is that the install command not only downloads the package, but also registers it as an installed package with support for updates and removal.

Install a PHP Version

While the winget download command only downloads a given PHP version, the winget install command downloads a Windows PHP build, verifies it, extracts it, and updates system PATH variable to make php available to run from the command line.

winget install PHP.PHP.8.4

winget install PHP.PHP.8.4
`winget install PHP.PHP.8.4` installs PHP on the system as a portable application, and updates the `PATH` variable on the system

It is possible to install multiple PHP versions simultaneously. Note that when installing a new PHP version, it can override the php executable path to the PHP version installed last.

In addition to the php executable, the Winget packages also add aliases with the PHP version as a suffix. For example, PHP 8.4 can be directly executed by running php84. However, support for multiple aliases is a work in progress, tracked at microsoft/winget-cli#2884.

Update PHP Packages

When a new patch version of an already-installed PHP version is available, winget update shows it.

Run winget update PHP.PHP.%version% to update to the latest patch version for that release. For example, to update PHP 8.4 to the latest version, run:

winget update PHP.PHP.8.4

Remove an existing PHP Package

To remove a PHP version installed using winget, navigate to system Settings > Apps > Installed Apps, locate the PHP version, and click "Uninstall" under it.

winget remove a PHP version

Recent Articles on PHP.Watch

All ArticlesFeed 
PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

A guide for Debian and Ubuntu on how to install PHP 8.4 on a new server or how to upgrade an existing PHP setup to PHP 8.4.
How to fix `mysql_native_password` not loaded errors on MySQL 8.4

How to fix mysql_native_password not loaded errors on MySQL 8.4

How to fix the SQLSTATE[HY000] [1524] Plugin 'mysql_native_password' is not loaded errors caused in MySQL 8.4 no longer enabling the mysql_native_password plugin by default.
How to fix PHP Curl HTTPS Certificate Authority issues on Windows

How to fix PHP Curl HTTPS Certificate Authority issues on Windows

On Windows, HTTPS requests made with the Curl extension can fail because Curl has no root certificate list to validate the server certificates. This article discusses the secure and effective solutions, and highlights bad advice that can leave PHP applications insecure.
Subscribe to PHP.Watch newsletter for monthly updates

You will receive an email on last Wednesday of every month and on major PHP releases with new articles related to PHP, upcoming changes, new features and what's changing in the language. No marketing emails, no selling of your contacts, no click-tracking, and one-click instant unsubscribe from any email you receive.

Support PHP.Watch — If you find the articles, version information, Codex, and other PHP.Watch contributions useful, consider supporting through GitHub Sponsors. Your sponsorship helps dedicate more time to creating valuable content and improving the PHP community. Together, we can keep the momentum going — thank you for your support!

Thanks to the highest tier sponsor: @TomasVotruba for your generous support to keep PHP.Watch moving 💜