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.
Search for PHP Packages on Winget
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
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
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 .
--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
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.