Movatterモバイル変換


[0]ホーム

URL:


How to install PHP on Windows using Winget

Published On26 Dec 2024

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

This article explains how tosearch,download,install,update, andremove Windows PHP binaries usingwinget. PHP packages are installed as portable applications that support modifying the system PATH variable, and require Winget to supportWinget 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 theMicrosoft documentation on Winget.

Windows PHP binaries are sourced fromwindows.php.net. Winget package manifests include information about the latest versions, their SHA-256 checksums, and the download links forx64 andx86 systems. All of the downloads will beThread-Safe builds. At the moment,Arm64 builds are not available.

The PHP packages are installed asportable apps, supportingmultiple PHP versions simultaneously.

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

Search for PHP Packages on Winget

All Windows PHP builds are under thePHP.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 namedPHP.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 runningapt search php ordnf 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, runPHP.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 runwinget show php8.4 for the same result.

Download PHP Windows Packages

winget allows downloading the ZIP files containing Windows PHP packages directly fromwindows.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, runwinget 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 packagedoes not modify anything else on the system. The difference betweendownload andinstall commands is that theinstall 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 thewinget download command only downloads a given PHP version, thewinget install command downloads a Windows PHP build, verifies it, extracts it, and updates system PATH variable to makephp 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 thephp executable path to the PHP version installed last.

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

Update PHP Packages

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

Runwinget 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 usingwinget, 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 
Install and Upgrade to PHP 8.5 on Debian and Ubuntu

Install and Upgrade to PHP 8.5 on Debian and Ubuntu

Explains how to install PHP 8.5 on a new Ubuntu or Deban server, or how to upgrade an existing PHP version to PHP 8.5.
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 fixmysql_native_password not loaded errors on MySQL 8.4

How to fix theSQLSTATE[HY000] [1524] Plugin 'mysql_native_password' is not loaded errors caused in MySQL 8.4 no longer enabling themysql_native_password plugin by default.
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.


[8]ページ先頭

©2009-2026 Movatter.jp