How To Downgrade Php Version In Xampp

In this blog post, we will discuss how to downgrade the PHP version in XAMPP. There may be times when you need to use an older version of PHP for compatibility reasons or to test your applications with different PHP versions. The following steps will guide you through the process of downgrading PHP version in XAMPP.

Step 1: Download the desired PHP version

First, visit the PHP Release Archive to download the desired PHP version. Make sure to download the Thread Safe (TS) version, which is required for XAMPP.

Step 2: Extract the PHP files

Extract the downloaded PHP files into the xampp\php folder. You can rename the existing PHP folder to keep a backup of the current version. For example, if your current PHP version is 7.4, you can rename the folder to php_7.4.

Step 3: Update the Apache configuration

Open the httpd-xampp.conf file located in the xampp\apache\conf\extra folder. Update the following lines to match the new PHP version:

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

Make sure to replace php7ts.dll, libpq.dll, and php7apache2_4.dll with the correct filenames for your PHP version.

Step 4: Update the php.ini file

Copy the php.ini-development or php.ini-production file from the new PHP folder and rename it to php.ini.

You may need to update the extension path in your new php.ini file. Look for the following line:

extension_dir = "C:\xampp\php\ext"

Make sure the path points to the ext folder within your new PHP folder.

Step 5: Restart Apache

Finally, restart the Apache server using the XAMPP control panel. If everything is configured correctly, the PHP version should be updated.

Step 6: Verify the new PHP version

Create a new PHP file in your web root directory (i.e., xampp\htdocs) with the following content:


Save the file as phpinfo.php and access it through your web browser (http://localhost/phpinfo.php). You should see the updated PHP version displayed.


Downgrading the PHP version in XAMPP can be done by following these steps. You can switch between PHP versions by simply renaming the PHP folder and updating the Apache configuration. This can be useful for testing your applications with different PHP versions or maintaining compatibility with older PHP versions.