ARTICLE AD BOX
How to properly update XAMPP and PHP 8.x
Note that it's not recommended to just swap out an older version of PHP in XAMPP to a newer version, as there's the possibility it could introduce problems and incompatibilities due to tools, configurations and codebases that weren't intended to be used together.
Instead, the safe, recommended way to update XAMPP's PHP version is to update it along with the binaries that PHP needs to work with - namely MySQL and PHPMyAdmin - to versions that are compatible with the version of PHP. This way you will also be able to take advantage of the security and speed advantages of updating to newer versions - for example, modern versions of PHPMyAdmin are miles faster and much less buggy than versions that are a few years old.
Unfortunately there is no easy way to update XAMPP, which is bizarre considering how old and mature it is as a project, but the steps below outline the easiest way to do so.
Rename your current, working XAMPP folder (located at C:\xampp by default) to XAMPP.old or something similar to indicate it's the old version.
Download the XAMPP installer for the version of XAMPP/PHP you want (the XAMPP version mirrors the PHP version to make it easier to know which PHP version you're getting), and install it to C:\xampp.
Go through the install process and feel free to deselect any software you don't need - like Mercury Mail and Tomcat - to prevent them cluttering up your installation, then wait for the install to complete.
Delete the following folders from C:\xampp and copy and paste their equivalents from C:\xampp.old:
htdocs mysql\data mysql\backupYou've now moved all of your website and database data over from your last installation, so if you didn't customise your XAMPP configuration a lot or don't care about moving your configuration over, you can stop at this stage and you will have a fully-working installation of XAMPP running on your new version of PHP, along with new software that is compatible with it.
Next, you need to copy over the configuration files from your old XAMPP installation at C:\xampp.old to the new one at C:\xampp.
First is the php\php.ini file - this file should not simply be copied over, as it contains configuration options that are very specific to the current PHP installation. If you've made changes to it or you're not sure whether you have, you can use a diff tool like diff --color -y <old php.ini> <new php.ini> to compare your old php.ini file with the one you just installed - if you see any lines in red, these are the lines you might need to copy over to your new C:\xampp\php.ini file, although note that even many of these might be unnecessary - usually they are removed by the developers because they're no longer needed by the newer PHP version.
The remaining configuration files and folders can simply be copied below into the same locations on C:\xampp, replacing the newer versions:
apache\conf\httpd.conf apache\conf\ssl.crt apache\conf\ssl.csr apache\conf\ssl.key phpmyadmin\config.inc.php apache\conf\extra\httpd-vhosts.confAll of these changes should be pretty safe but it's always a good idea to keep the C:\xampp.old folder around for a few weeks while you're testing out your new XAMPP server. If it turns out you missed something you can then just copy it over later.
You should now be able to open the XAMPP Control Panel to start the server and confirm that your new versions of Apache and MySQL are working, and visit localhost/phpmyadmin to confirm that the latest version of PHPMyAdmin has been installed successfully. Finally, run php -v to confirm that you're on the installed version of PHP.
