Some time we are in a situation where we badly need another PHP version to check our projects in local machine. We have some solutions too for this like Vagrant or Docker which provides us virtual environment. But for some one who heard it first time or in a hurry what will be the solution then?
Let see how we can quickly do it in our local machine in out known environment. I am going to show it for Windows user. Let assume i have a xampp setup of PHP 7.0 but i suddenly in need for PHP 5.6.
- Let download a older version of xampp from here https://www.apachefriends.org/download.html.
- STOP all apache and mysql service from XAMPP control panel.
- Install it in xampp_5.6 directory NOT xampp because we already have installed xampp with PHP7.0
- We have to change the default apache port so that we can run two apache at a time in different port
- Open xampp_5.6\apache\conf\httpd.conf file in text editor and find
Listen 80
and replace withListen 5656
OR any number you like, Also replaceServerName localhost:80
withServerName localhost:5656
. Make sure that both number are same.
- Open xampp_5.6\apache\conf\httpd.conf file in text editor and find
- We also need to change the SSL port
- Open xampp_5.6\apache\conf\extra\httpd-ssl.conf file in text editor and find
Listen 443
and replace withListen 444
- Open xampp_5.6\apache\conf\extra\httpd-ssl.conf file in text editor and find
- Now we need to change MySql port
- Open xampp_5.6\mysql\bin\my.ini file in text editor and find
3306
and replace with
- Open xampp_5.6\mysql\bin\my.ini file in text editor and find
Now run apache and mysql from xampp control panel in xampp_5.6 And we have two setup with two different PHP version.