Why switch between PHP versions when you can use multiple PHP version at a same time with a single xampp installation? With a single xampp installation, you have 2 options:

XAMPP 32-bit versions for Windows: Microsoft Windows 32-bit requirements: OS: Microsoft Windows XP, 7, 8, 8.1, 10 (32bit or 64bit) CPU: Intel Pentium 4 (2. Old versions; XAMPP 1.8.1; XAMPP 1.8.1. Many people know from their own experience that it's not easy to install an Apache web server and it gets harder.

  1. Run an older PHP version for only the directory of your old project: This will serve the purpose most of the time, you may have one or two old projects that you intend to run with older PHP version. Just configure xampp to run older PHP version only for those project directories.
  2. Run an older PHP version on a separate port of xampp: Sometimes you may be upgrading and old project to latest PHP version when you need to run the same project on new and older php version back and forth. Then you can set an older PHP version on a different port (say 8056) so when you go to http://localhost/any_project/ xampp runs php 7 and when you go to http://localhost:8056/any_project/ xampp runs php 5.6.

Lets set it up.

Step 1: Download PHP

Older version of xampp

So you have php 7 running under xampp, you want to add an older php version to it, say php 5.6. Download the php zip archive from here and extract the files under c:xamppphp56.

Step 2: Configure php.ini

Open c:xamppphp56php.ini file in notepad. If the file does not exist copy php.ini-developmentto php.ini and open it in notepad. Then uncomment the following line:

Step 3: Configure apache

Open xampp control panel, click config button for apache, and click Apache (httpd-xampp.conf). A text file will open up put the following settings at the bottom of the file:

Note:You can add more versions of PHP to your xampp installation following step 1 to 3 if you want.

Step 4 (option 1):[Add Directories to run specific PHP version]

Xampp Php Versions

Now you can set directories that will run in php 5.6. Just add the following at the bottom of the config file to set directories.

Step 4 (option 2):[Run older PHP version on a separate port]

Now to to set PHP v5.6 to port 8056 add the following code to the bottom of the config file.

VersionXampp older version

Finish: Save and Restart Apache

Xampp Version 7

Save and close the config file, Restart apache from xampp control panel. If you went for option 2 you can see the additional port(8056) listed in your xampp control panel.

Xampp Old Version Php 5.3

Reference: