I’ve been using XAMPP as my development server for years . I love its simplicity and effectiveness that is why I do not like to use the EasyPHP and WAMP other alternatives. A few days ago , I started XAMPP Apache and my surprise, it will run and stop , and then display the following error message ; Error : Apache unexpectedly closed. This may be due to blocked ports , missing dependencies , Improper privilege , corruption , or by another method , a shutdown. Select “/xampp/apache/logs/error.log” file Windows Event Viewer and more clues
From the error message my hypothesis was another program is already using theport 80. My hypothesis was proven to be true reading this stackoverflow thread.
If you are experiencing this problem with XAMPP, I am going to share two simple yet effective methods that solved this problem for me.
Changing XAMPP Default Port
If you are desperate to get XAMPP up and running, you should consider changing the port from the default 80 to say 7777.
✔ In the XAMPP Control Panel, click on the Apache – Config button which is located next to the ‘Logs’ button.
✔ Select ‘Apache (httpd.conf)’ from the drop down. (Notepad should open)
✔ Do Ctrl+F to find ’80’ and change line Listen 80 to Listen 7777
✔ Find again and change line ServerName localhost:80 to
✔ Save and re-start Apache. It should be running by now.
The only drawback to this technique, you must explicitly include the port number in the URL of the local host . Instead of http: // localhost it became HTTP: // localhost : 7777 . Use port 80 to stop the application / service If you do not want to run XAMPP on a different port , still we want to continue to use the default port 80 , you need to find and has been using the port to stop the program or application. Such a plan is in the popular Skype.
Navigate to Tools -> Options – > Advanced – > Connections ; deselect / uncheck use alternative ports 80 and 443 incoming connections. In XAMPP quit Skype to make the change to take effect , and then restart Apache. It should be up and running.
If the above conduct ceremonies and its Apache refuse to run , as I have experienced , it is very likely that another program still using port 80 . This is Microsoft ‘s IIS Web Deployment Agent service in my case . To find the 80 -port and run XAMPP conflicting program , click on the rightmost button Netstat. You will see a list of programs and their respective operational ports and PID
Alternatively run CMD and enter netstat -aon
Find the program to run port “80” and noted its PID. Open the Windows Task Manager ( press Ctrl + Alt + Del key ) , go with the PID of the program name identification . To stop the conflicting program , simply open SERVICES.MSC ( with the gear icon in Windows 7, it just “Services” ) or run CMD, enter services.msc and stop the program.
Mind you, if you find the conflicting program in Windows Task Manger, you can just right-click and stop the service.
Now that the program has been stopped, re-start Apache and XAMPP should work fine.