how to change php version in windows

How to switch PHP versions easily in Windows 10 and 11

Switching PHP versions on Windows 10 and 11 is a common necessity for developers working on various projects with different PHP compatibility requirements. Fortunately, achieving this task can be relatively straightforward with the help of tools that simplify the process. By leveraging applications like XAMPP, Laragon, or manual configuration adjustments, developers can seamlessly switch between different PHP versions on their Windows machines. This flexibility allows for efficient testing and development across diverse PHP environments without the need for complex setup procedures. In this guide, we’ll explore practical steps to easily switch PHP versions on Windows 10 and 11, empowering developers to adapt to the specific requirements of their projects.

Also read:

How to switch PHP Version

Switching the PHP version on your Windows computer is super easy by tweaking some settings. I think it’s the simplest and most flexible method out there. You can do it by playing around with something called “environment variables.” Even though there are other ways to change your PHP version, I find this one the easiest. It gives you the freedom to switch between PHP versions without any hassle. Let’s dive in and see how to do it!

To get started, First, you have to open the Environment Variables window

To open Environment Variables type “env” in the search bar at the bottom and you can see the option below

environmental variables in windows

Click on the first option to open the Environment Variables Screen

You will get a similar screen in the screenshot below

change path and variables in windows

Now, select the path option under the System Variables

change paths in system variables

Change the variables to make the changes

If you want PHP 7 to be used by the system move it to the top or else if you want PHP 8.1 to be used by the system move it to the top. Repeat this step for any PHP versions and you are done.


  • To switch PHP versions using Environmental Variables you should add the path of the program
  • This tutorial shows verisons 7 and 8 as examples
  • In some machines, the system variables can’t be edited, in this case, change from user variables.


This is the easiest and most flexible method for changing PHP versions for machines using the Windows Operating System. Modern tools are available nowadays to handle this operation more smoothly.

Follow TechBiriyani on FacebookTwitter to get all the latest updates.

Leave a Reply

Your email address will not be published. Required fields are marked *