Categories
Pro Tips

Switch PHP Versions in XAMPP

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.

Codeable.io

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.

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.

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.

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.

Leave a Reply

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