How to Switch your PHP Version in Windows (without XAMPP)


Okay, say you’re developing a php application.
You’re using php, and mysql by installing it directly on your windows.
Why? Many reason, perhaps you would like to emulate the production environment, maybe you want to try not using XAMPP, etc.
You installed your PHP 7.4 on your system long time ago and now you’re regretting it.
“wait, what do you mean i have to upgrade my php?! I don’t even remember how i installed it in the first place!”
But you’re left with no choice, you can’t clone that cool repository that you wanted unless you upgrade your php.
But don’t worry, upgrading or even switching php version is so simple, way simpler than you thought.
Okay, first, i assume you have your php folder on your C drive, or somewhere else.

and i assume you also have the folder listed in your environment variable path

So, all that’s left is just installing the upgraded version of PHP, or rather i would say, placing the folder.
Head to PHP website, and select the version that you wanted.

Download the source code version

Once you’ve downloaded it, head back to the old php folder, and rename it to something other than php, why? That is because we will extract our freshly downloaded php into the php folder.

Now, we’re almost there! Head into the folder, and rename the php.ini-development or php.ini-production file into php.ini (we’re gonna need php.ini for the configuration) and while we’re at it, configure the extensions as it will be used especially during development.

Now we’re all good! You can test it out by going to your terminal and type
php -v

Perfect! Now we’re finished!
Hope this helps!