How to install & use multiple versions of PHP on Windows

Actually, this is a super easy.

Download PHP windows binaries from https://windows.php.net/download/ for PHP 7.3, PHP 7.4 and PHP 8.0.

Put all of them under folders e.g.

C:\Program Files\PHP\7.3
C:\Program Files\PHP\7.4
C:\Program Files\PHP\8.0

Let’s choose PHP 7.4 as a default one, for others, take the php.exe and rename them php73.exe and php80.exe respectively.

Lastly, add all three folders into Windows Path variable under: Advanced system settings --> Environment Variables --> System variables.

Windows restart might be required.

Now you can call $ php --version in command line which will outputs PHP 7.4.XX (cli) ..

And $ php80 --version will outputs PHP 8.0.XX (cli) ..

Leave a Reply