We’re not using not on WAMP or XAMPP for this one. I find Laragon to be much easier when dealing with multiple versions of PHP. Download Laragon from https://laragon.org/download/ and install it.
Out of the box, we get PHP 8.1 and it just works. We can grab a few more versions (7.x and 8.x) from https://windows.php.net/download and extract them into (Laragon’s install folder)/bin/php. Then right-click on the Laragon tray icon, select PHP and switch to the version we need. We can easily enable PHP extensions from the Laragon tray icon, select PHP, select Extensions, and enable the ones we need.
Switching the Apache web server Document Root folder to point to our project code is just as easy. Right-click on the Laragon tray icon, select www (2nd from the top, may not necessarily say www), select Switch Document Root, then browse to our project code.
With the above procedure, we can switch projects and their required PHP version easily. We can also do the same thing for MySQL, MariaDB, Apache, NGINX, etc, but I find that the web server and database server versions don’t have too much impact on a development environment.