How to run multiple XAMPP's on same machine?
Running different versions of PHP along with different version of MySQL. It can be done doing change in XAMPP server port.
Follow below steps to change the XAMPP server port number(s):
Stop the XAMPP server(s), if it is running already.
Open the XAMPP file(s) which we make to run with as secondary XAMPP.
Update httpd.conf
- From the Secondary XAMPP Control Panel, under Apache, click the Config button, and select the Apache (httpd.conf) or Open the file [Secondary XAMPP Installation Folder]/apache/conf/httpd.conf
- Now search for the string Listen 80 (I'm assuming that your Secondary XAMPP was also using the port 80. Otherwise, just search for the string 'Listen').
- This is the port number which XAMPP uses. Change this 80 to any other number which you prefer (In my scenario I'm using port 88).
- Then search for the string ServerName and update the port number (new assign one) there also.
Update httpd-ssl.conf
- From the Secondary XAMPP Control Panel, under Apache, click the Config button again, but this time select the Apache (httpd-ssl.conf) or Open the file [Secondary XAMPP Installation Folder]/apache/conf/extra/httpd-ssl.conf
- Now search for the string Listen 443 (I'm assuming that your Secondary XAMPP was also using the port 443. Otherwise, just search for the string 'Listen').
- This is the port number which XAMPP uses. Change this 443 to any other number which you prefer (In my scenario I'm using port 4438).
- Then search for the string <VirtualHost _default_:443> and ServerName localhost:443 and update the port number (new assign one) there also.(In my scenario <VirtualHost _default_:4438> ServerName localhost:4438 )
Now save both files and re-start XAMPP server and you are done.
wait wait wait ...
still MySQL port change not done, if we try to access server both XAMPP try to access same MySQL port that is 3306
So if we need to change the secondary XAMPP MySQL port do below mention steps
Update my.ini
- From the Secondary XAMPP Control Panel, under MySQL, click the Config button, and select the MySQL (my.ini) or Open the file [Secondary XAMPP Installation Folder]/mysql/bin/my.ini
- Now search for the string port(I'm assuming that your Secondary XAMPP was also using the port 3306 that is default port value of MySQL).
- This is the port number which XAMPP MySQL uses. Change this 3306 to any other number which you prefer (In my scenario I'm using port 33068).
- update for both client & mysqld port value.
Now save both files and re-start XAMPP server and you are done.
Why do we need to change the port number?
In general, these days, it is very common that a web developer needs to have multiple web servers running, all at the same time. For example, an XAMPP server can be used to run the local Magento or WordPress blog, while a JBoss server also needs to be up for testing a java web applications or other version of php need to run.In such scenarios, if two or more servers are trying to use the same port number, then the late comer will fail to get the port. So, it becomes necessary to change any one server's port number to avoid the conflict.
Some more updates
For secondary XAMPP if update admin url access
- In secondary XAMPP Control Panel, click on Config button, click on Service and Port Setting,
- Service Setting Panel will open,
- In that choose Apache tab -> Apache Setting -> Main port change to (httpd.conf port value for example 88) and for SSL port change to (httpd.conf port value for example 4438)
- Then choose MySQL tab -> Apache Setting -> Main port change to (my.ini port value for example 33068)
- then Save then Save Config Panel and then re-start server and you are done now
- You can click in XAMPP control panel apache admin button you will land to proper admin page.
but for MySQL admin button click still secondary MySQL admin page (phpmyadmin) not come as expected :(
How do I listen to the new port for MySQL and 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
- Open the file [Secondary XAMPP Installation Folder]/phpMyAdmin/config.inc.php
- Now search for the string $cfg['Servers'][$i]['host']
- and update value '127.0.0.1' with '127.0.0.1:33068' (In my.ini port value we updated as example 33068 so we update that here)
Finally secondary XAMPP is ready to use without conflict with other Server.