0

How to Install and Run Multiple XAMPP on Windows ?

xampp install multiple php versions,xampp php version switcher,rename xampp folder,how to run multiple php versions xampp,multiple php versions apache windows,xampp two versions,xampp php 5 and 7,using 2 xampp,multiple php versions apache windows,multiple php versions apache ubuntu,multiple php versions centos,multiple php versions nginx,ubuntu 16.04 multiple php versions,multiple php versions apache centos,debian multiple php versions,php version manager ubuntu

 

Hi guys ! Hope you are good and doing well.some day before i need to test two websites build with php with two difference version (PHP 5 and PHP 7).But problem was that i was working on old xampp with php 5 version and the latest site need php 7 to work properly in localhost.Either i have to remove old xampp and install new one and move my all files in new xampp folder or find a new way how i can keep the both running whenever i need so i searched the internet and find a good way that i can use multiple xampp in my system and can run them any time.Even i don’t need to turn off another one when i am using a xampp i can use both at same time.So if you also wanna know then read the complete post.

 

1. Why Use Multiple Xampp ?

along with the development of php , many new features and functionalities are added and many of them are removed.So if you have some old applications and some are newer one then you know very well that your old sites won’t work on new version of php and there is no chance that your new sites will work on old version. Definitely they will threw mysql database connection and many more errors & warnings.So in this case you have to use both old and new version of php side by side.So in this post we will install multiple xampp on windows under two possible situations.

 a. Running different versions of PHP along with same version of MySQL Server.
b. Running different versions of PHP along with different version of MySQL.

and we will run both simultaneously.

This time, I’ll use two portable version of XAMPP: (1) XAMPP version 5.6.21 which use PHP version 5.6.21, and (2) XAMPP version 7.0.6 which use PHP version 7.0.6.

You can use other versions by downloading the file through XAMPP Windows at SourceForge.net download page or visit the home page of Apache Friends to download the latest version.

There are many kinds of XAMPP installer (.exe, .zip, .7z, full install, portable, etc…), you can find the difference here: Install XAMPP On Windows – A Complete Guide in the downloading XAMPP section.

 

2.  How to Install Multiple XAMPP on Windows  ?

lets start the process :

a. Running different version of PHP,  with  same version of MySQL server

   1 . Extract / install xampp file that we have downloaded, the files can be extracted anywhere, I extract it at the same drive that is E drive.

pic-1
2. Changing the apache port

The default port used by apache (in xampp) is 8080. If one of the apache has already used that port, then the others can’t use it, so we need to configured another apache (in xampp) with different port eg: 7777. Later, the localhost will be accessed using the port, e.g: http://localhost (using 8080 port) and http://localhost:7777 (using 7777 port)

For example, we’ll change the default port for the XAMPP 7.0.6 to 7777, to do so:

  • Open httpd.conf (apache config) file located in the apache/conf directory
  • Find the words of Listen 80 and ServerName localhost: 80 then change the number from 80 to 7777

pic-2

and

pic-3
  3. Important. Change the SSL port too

If Apache Server of XAMPP 5.6.21 has been started, then, when we run apache on XAMPP 7.0.6 (port 7777), an error will be raised:

From the message above, we know that XAMPP wants to use 443 port which is an SSL port, the port is activated immediately when we run apache on xampp 5.6.21.

To overcome this, we have to change the SSL port used by apache of XAMPP 7.0.6, to do so:

  • Open the httpd-ssl.conf file located in the apache\conf\extra directory
  • Find the words of 443 (eg: Listen 443 and ServerName localhost: 443 ), replace 443 with others, e.g: 444 then save the file.

Done. Run the both XAMPP, you should see it works as shown in the following figure:

pic-4

Description: the above picture shows that apache of xampp 5.6.21 (upper image) runs using HTTP port of 8080 and SSL port of 443, while the apache of xampp 7.0.6 (lower image) using 7777 as HTTP port and 444 as SSL port.

Done. You’ve successfully run two version of PHP side by side.

b. Running different versions of PHP and different version of MySQL

If both XAMPP use MySQL version < 5.5, then both MySQL server can be run together, but if one of them use newer version of MYSQL e.g >= 5.5, then XAMPP will display the following error:

 

pic-5

 

The error occurs because port of 3306 is already used by the first xampp (xampp 5.6.21), so we need to change the MySql port on the second xampp (xampp 7.0.6)

To change the MySQL port:

  1. Open my.ini file (MySQL configuration file) which is usually located inside the “xampp/mysql/bin/” directory.
  2. Find the words of port = 3306 then change that number, for example: 3307. (MySQL client and server) pic-6
  3. Once finished, run both MySQL servers, you should see it running side by side, like the following figure: pic-7Done. you’ve successfully run MySQL server side by side simultaneously.The next question is “could we run the phpMyAdmin for both servers”? the answer is YES, read on below

3. How to Run phpMyAdmin on Different Port of MySQL

After you successfully install multiple MySQL server on Windows and run them side by side, then to be able to use it using phpMyAdmin, we need to adjust the configuration of phpMyAdmin, otherwise, both phpMyAdmin will access the same MySQL server (XAMPP 5.6.21)

By default, phpMyAdmin will access MySQl server using port of 3306, to be able to access the 3307 port (XAMPP 7.0.6), we need to change the configuration file, to do so:

 

  1. Open config.default.php file located in the “phpMyAdmin\libraries” directory, in this case, XAMPP 7.0.6.
  2. Search (Ctrl + F) the words of port, then find this parameter: $cfg['Servers'][$i]['port'] = ''
  3.  Fill the quotes with the number of port we will be used, e.g. 3307, so it becomes $cfg['Servers'][$i]['port'] = '3307'

Done. Open your browser dan run both phpMyAdmin (http://localhost/phmyadmin and http://localhost:7777/phpmyadmin), if successful, it will look like the following image:

 

pic-8

The image above shows that phpMyAdmin that uses apache port of 7777 (http://localhost:7777) use MySQL port of 3307. (127.0.0.1:3307)

Leave a Reply

Your email address will not be published. Required fields are marked *