How to change PHP version in XAMPP for Windows
Published: 2022-08-10 15:20:44

Have you ever wondered how to upgrade or downgrade your PHP version in XAMPP without having to install another XAMPP software?, Well i have and from most answers i saw online, the best option was to download an updated version of XAMPP, but looking at it, i knew there had to be a better way so i made some research and was able to figure it out. In this article, i would show you how i changed my PHP version from 7.4.15 to 8.0.19.

This is a screenshot of my current PHP version

![Image of PHP 7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/43qvwct4spw2goklgfih.png)

If you don't know your current PHP version, you can use  [this link](http://localhost/dashboard/phpinfo.php) to check it.

## STEP 1
Download the PHP version you want to use, you can find the PHP version you want to download from PHP's download website [for windows](https://windows.php.net/download/), but there is something you need to know before downloading any package, the download for a PHP version exists in 2 types - thread safe and non thread safe. Since you are using PHP with XAMPP, you are going to download the non-thread safe version because there is an apache file it has that would be used to configure XAMPP with PHP.


![PHP non thread safe version](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pnc1iu6dgxzykro3ufhz.png)

After locating it, download the zip file. If you are running on a 32-bit system, download the non-thread safe version labelled with x86.

## Update
Depending on the PHP version you want to change to, you might need to download the Thread safe version instead if you downloaded the non thread safe version, and you didn't see the Apache file there.

## STEP 2
After you have downloaded it, extract the zip file and rename the extracted folder to "php", open the folder to find the apache file i mentioned in step 1 as shown in the image below. Once you have seen it, move the php folder to your xampp folder. Remember to make sure the current php folder in the XAMPP folder is either removed or renamed to something else so that the name won't conflict with the one you are moving.

![Apache file for XAMPP configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a24505sj7v4unc4lwsrp.png)

## STEP 3
After moving the php folder into the XAMPP folder, open the folder and look for the php.ini config file. Whenever you download a PHP package, the php.ini file comes in two parts, **php.ini-development** and **php.ini-production**. These two config files represent the settings running on your development and production environments. Since you are using XAMPP, you would be using the development config file, so rename that config file to php.ini.

## STEP 4
Open your XAMPP control panel. Under the actions option for Apache, look for the config button, click on it and select the Apache (httpd-xampp.conf) config file to open it. This is the file that XAMPP uses to configure PHP properly, look for the following:

```
LoadFile "C:/xampp/php/php7ts.dll"
LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
```

- Change **php7ts.dll** to **php8ts.dll**
- Change **php7_module** to **php_module**
- Change **php7apache2_4.dll** to **php8apache2_4.dll**

**NOTE** - Search everywhere in the file for "php7_module" and change it to "php_module" as you might need to change it in some places.

## STEP 5
After you have done all this, save the changes and restart your server, go back to this [url](http://localhost/dashboard/phpinfo.php) and confirm that your PHP version has changed. if everything was done correctly, you should see that you have successfully changed your PHP version!


![PHP version 8 image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/63j0fniq1r7vfjg2p9g2.png)

Very easy and convenient. You can agree it is really not difficult to change your PHP version in XAMPP as it is quite simple to do. Connect with me on [twitter](https://twitter.com/Kansoldev) and [linkedin](https://www.linkedin.com/in/oyinkansola-yahaya/) to find out more about me and my work.