Categories
Pro Tips

Switch PHP Versions in XAMPP

Learn how to easily switch PHP versions for your XAMPP local development environment.

Have you ever wanted to change only the PHP version for your XAMPP installation?

In this quick pro tip post, I will show you how to do that easily without the need to have multiple XAMPP installs on your system.

Discover more insights in our top-rated article on Create WordPress Child Themes with WP-CLI

Sometimes you even need to downgrade the PHP to use some application. For example, if you want to set up WordPress Coding Standards with Composer on Windows, you cannot run in with PHP 8.0.

You can have multiple PHP distros and switch between them with a couple of simples steps.

Let’s say you are running XAMPP with PHP 8.0 and want to downgrade to PHP 7.4.

  1. Go to https://sourceforge.net/projects/xampp/files/
  2. Choose your OS.
  3. Choose the XAMPP version with PHP 7.4.
  4. Download the *.zip for your OS e.g. xampp-windows-x64-7.4.24-0-VC15.zip.

Note: I know that if I go to XAMPP Windows / 7.4.24 the XAMPP PHP version will be 7.4

The next step will be to open the downloaded zip archive and extract the php folder as well as the apache/conf/extra/httpd-xampp.conf file on your computer.

Now you go to your install and rename the C:XAMPPphp to C:XAMPPphp-8.0 and C:XAMPPapacheconfextrahttpd-xampp.conf to C:XAMPPapacheconfextrahttpd-xampp-8.0.conf.

Check out our frequently visited guide on Create WordPress Child Themes with WP-CLI

This way, you can always go back to version 8.0 if you need to do that in the future.

The last step is to copy the extracted php folder and httpd-xampp.conf version 7.4 into your XAMPP installation.

For a deeper dive, check out our popular post on Create WordPress Child Themes with WP-CLI

You can have as many PHP versions as you would like, and you only need to keep track of the php source and configuration files.

‘Til, the next time.

If you found this helpful, our comprehensive guide on Create WordPress Child Themes with WP-CLI has even more.

Leave a Reply

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