This is done with chocolatey installed.
- Run Windows Powershell with admin rights
- Execute
choco upgrade php --version=8.2 - Check current php version after installation with
php -v
If still on old version:
- Run windows search for "Edit the system environment variables"
- Click on "Environment Variables"
- Under "System variables", click on "Path" and Edit
- Remove the outdated php directory (e.g.
C:\xampp\php) - Notice the new php version path that has "php82"
- Check php version
If still not updated:
- Check php path with
which phpin git bash (the directory will beC:\xampp\phpif it outputs/c/xampp/php/php) - Go to the new php version path and replace folder to the directory (have to rename the new folder to match the original, mine will be renamed from "php82" to "php")
- Check php version
How to upgrade php version on Windows 10 - Stack Overflow
Upgrading PHP in XAMPP for Windows? - Stack Overflow
how to install php in windows 11
Updating PHP on Windows servers
Videos
You can uninstall composer, and while re-installing it will ask you to point at your PHP directory which is going to be C:\wamp64\bin\php (usually) at that point you can choose which PHP version you would want to use. good luck.

This means you have yet another installation of PHP in your system. Check your Programs in Control Panel and remove such installation.
However, you can modify your PATH environment variable as well. Procedure
Just remove the path that points to any PHP installation directory.
Else, otherwise, if you are unsure about changing the PATH variable (which can lead to serious problems if not set well), you can just delete the directory that the PATH variable points to.... (I mean the PHP directory)
The totally better solution is to add the path of your PHP7 bin directory at the beginning of the PATH variable. You should also make available composer in this PHP7 bin directory.
Such as, replace the C:\php in your path with C:\wamp\bin\php7 or whatever the location of the PHP7 path is..
Take a backup of your htdocs and data folder (subfolder of MySQL folder), reinstall upgraded version and replace those folders.
Note: In case you have changed config files like PHP (php.ini), Apache (httpd.conf) or any other, please take back up of those files as well and replace them with newly installed version.
Simplest method to upgrade PHP in XAMPP:
- Download latest portable version of
XAMPP. - Extract the archive(not where
XAMPPalready installed). - Copy the
PHPfolder from the extracted archive. - Keep back up of
PHPfolder which is in installedXAMPPdirectory. You can backup it like changing thePHPfolder name toPHP-oldor likePHP-version-number - Paste the
PHPfolder which you copied from the extracted archive. - Replace the
php.inifile with your backup folderphp.inifile in case you have changed the default settings earlier. - That's all, start/restart the
server.
PHP is a scripting language that commonly has been used to implement a content management systems. It is my recommendation that you move anything that is dependent on PHP to a Linux machine. Microsoft ended their support and involvement of PHP about 5 years ago and at php 8.0. If you want to do like I do, utilize the tools on the system to manage the PHP installations (phpmanager and Windows Platform Installer) you can no longer do that. The infrastructure for both of those are gone (iis.net). Since PHP is an open source project, you can go directly there and get what you want, but you have also now acquired the resposibility for doing it yourself.
On top of that with the age of these servers, you have to also assess the applications that are using PHP. The upgrade from 5.6 to 8.2 isn’t likely to be smooth. Something built for 5.6 is far from being compatible with 8.x You have at least the step from version 5 to 7 and 7 to 8 to consider.
I’ve just inherited some customer facing web servers and have been asked by the security team to update PHP on them, as they are “slightly” out of date.
I’ve never had anything to do with PHP before, have no idea what it is, how it works or anything… and I am looking for some straightforward guidelines to updating it while ensuring that our customer sites are not affected in anyway…
Has anyone got any pointers?
They’re 2 x Windows Server 2012 R2 and 1 x 2016. The 2012R2s have PHP version 5.6.31 and the 2016 has version 7, and we use IIS.