The core components of XAMPP are Apache HTTP server and MySql i.e Maria DB. Sometimes we get an error while starting them, this error is Apache unexpectedly shutdown or MySql stopped unexpectedly or the port is already occupied. So to solve them we need to change the port number from some of the configurations files. In this post, we will try to resolve Apache’s unexpectedly shutdown error.
As you can see in the above image when I try to start the Apache service I get the error highlighted in red. It is because the Apache’s default port is 80 and in my system, it is already occupied by some other process that is why it is not starting the apache service. We need to change the port in order to start our apache service.
First, we need to make changes in the apache(httpd.conf) file. Open that file like shown above. In this file we will change the port from 80 to 8082 as shown below.
After changing that port we will make changes in the same file. Search for ServerName over there you will get to see the localhost:80 you can change it to localhost:8082 as shown below. You need to keep the same port in both places. Save this file and close it.
After this, we need to make changes in one more file i.e. Apache(httpd-ssl.conf). Open that file as shown below.
Here we will change the port from 443 to 4433.
Now, try to start the apache service if it starts successfully then the background of Apache will be light green. And you will get to see the port numbers which we have changed just now will be shown in front of the start button. It means your apache service is started.
If you are getting the same error after changing the port then increase the port number by one for example, if you have set your port number as 8082 and still it is not working then change it to 8083. Follow the same procedure for other ports and try again. Your error will definitely get resolved and it will look like as below.
Now, go to the browser and type localhost:8082 or whichever port you have kept you will get to see the following result. This means your apache is working fine.
In the next post, we will see how can we resolve the MySql error.