I'd like to run PHP7 and PHP8 on the same computer

If you have a spare 20Gb on your hard-drive then consider installing a dual Boot Linux Operating System. Most Linux operating systems can be first tried using a USB and then installed alongside Windows.

I use Ubuntu and swap PHP versions using the following batch files run from the command line::

file: php-7.sh

#!/bin/bash 

# Usage:  ~/./php-7.sh

sudo a2dismod php8.0
sudo a2enmod  php7.4

systemctl restart apache2

file: php-8.sh

#!/bin/bash 

# Usage:  ~/./php-8.sh

sudo a2dismod php7.4
sudo a2enmod  php8.0

systemctl restart apache2
1 Like