How to Install and Run Multiple XAMPP on Windows Side By Side

Previously we have discussed how to install XAMPP on windows, now we’ll discuss how to install multiple xampp on windows and run it simultaneously.

Along with the development of PHP, many new features were added and many old features were removed, so if you have multiple applications and some of them only work in old version of PHP and others run in new version, e.g PHP 7, then you need to install two versions of PHP most probably along with MySQL too.

I. Some Possibilities

Another situation is when we want to test some different version of PHP or MySQL, so in this tutorial we’ll install multiple xampp on windows under two possible scenarios:

  1. Running different versions of PHP along with same version of MySQL Server.
  2. Running different versions of PHP along with different version of MySQL.

AND we’ll make them run 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.

II. How to Install Multiple XAMPP on Windows

Now, let’s do the scenarios:

1 Running different version of PHP, but with the same version of MySQL server

To install multiple version of PHP with single MySQL server, follow these steps:

  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.

    Folder Location

  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

    How to Install Multiple XAMPP on Windows - Changing The Apache Port

    and

    Changing The Apache Port

  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:

    18:46:45 [Apache] Problem detected!
    18:46:45 [Apache] Port 443 in use by "d:\xampp-5.6.3.0\apache\bin\httpd.exe" with PID 8736!
    18:46:45 [Apache] Apache WILL NOT start without the configured ports free!
    18:46:45 [Apache] You need to uninstall/disable/reconfigure the blocking application
    18:46:45 [Apache] or reconfigure Apache and the Control Panel to listen on a different port
    

    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:

    Running Multiple Apache-XAMPP Side by Side

    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.

2 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:

Running Multiple MySQL Server Side by Side - Error

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)

    Changing MySQL Port

    In the above example, I change the MySQL port of XAMPP 7.0.6 to 3307.

  3. Once finished, run both MySQL servers, you should see it running side by side, like the following figure:

    Running Multiple MySQL Server - XAMPP Side by Side

Done. 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

III. 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:

How to Run phpMyAdmin on Different Port of MySQL

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)

Furthermore…

We can make apache and MySQL servers start along with the windows start automatically, so we do not need to start it manually one by one, to do so, we need to install both apache and MySQL services to the windows service, you can read the guidance here:

  1. Apache Service: Installing Apache Service Using XAMPP or Installing Apache Service Using Command Prompt
  2. MySQL Service: Installing MySQL Service Using XAMPP or Installing MySQL Service Using Command Prompt

33 Responses

Leave a comment

Like Us

Social