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.
- How to fix Row size too large (> 8126).
- Fix Access-Control-Allow-Origin Issue
- Git .ignore not working for certain files
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
Click on the first option to open the Environment Variables Screen
You will get a similar screen in the screenshot below
Now, select the path option under the 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.