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.
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
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-development
to 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]
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.
Finish: Save and Restart Apache
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.
Reference: