Follow these steps to change the XAMPP server port number:
1)Stop the XAMPP server, if it is running already.
2)Open the file [XAMPP Installation Folder]/apache/conf/httpd.conf.
3)Now search for the string Listen 80 (I’m assuming that your XAMPP was 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.
4)Then search for the string ServerName and update the port number there also.
5)Now save and re-start XAMPP server and you are done.
Why do we need to change the port number
We need to change the port number because, there is all ways a need to have multiple server running . so the port get occupied by other service(server) therefore there is a need to change the port of xammp server . 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.