Apache failed to start in Xampp

How To Fix XAMPP – Error: Apache shutdown unexpectedly

I have been using XAMPP as my developmental server for years now. I have come to love it simplicity and effectiveness which is why I still haven’t use other alternatives like Wamp and EasyPHP.

Few days ago, I started Apache on XAMPP and to my surprise it will run and stop and afterward displays the below error message;

Error: Apache shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash, or a shutdown by another method.
Check the “/xampp/apache/logs/error.log” file
and the Windows Event Viewer for more clues

From the error message my hypothesis was another program is already using the port 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
    ServerName localhost:7777

    ✔ Save and re-start Apache. It should be running by now.

    The only demerit to this technique is, you have to explicitly include the port number in the localhost url. Rather than http://localhost it becomes http://localhost:7777.

  • Stop the application / service using the 80 port

    If you do not want to run XAMPP in another port, and still want to continue using the default port 80, you need to find and stop the program or application already using the port.
    One of such program is the popular Skype.
    Navigate to Tools -> Options… -> Advanced -> Connection; uncheck / un-tick the use port 80 and 443 as alternative for incoming connection.
    Quit Skype for the change to take effect and then re-start Apache in XAMPP.
    It should be up and running.

    If after performing the ritual above and it Apache refuse to run just like I experienced, then it is very likely that another program is still using the port 80. It was Microsoft IIS’s Web Deployment Agent Service in my case.

    To find the program running port 80 conflicting with XAMPP, click the Netstat button at the far-right. You will see a list of programs together with their respective running port and PID.
    XAMPP Netstat listing programs, port and PID

    Alternatively run CMD and enter netstat -aon
    Netstat in CMD

    Find the program running port “80” and take note of it PID.
    Open Windows Task Manger (Ctrl+Alt+Del), take cognizance of program name with the PID.

    To stop the conflicting program, just Open SERVICES.MSC (in windows 7, it just “services” with a gear icon) or run CMD, enter services.msc and stop the program.
    Web Deployment Agent Service stopped - Services Microsoft Management Console

    Mind you, if you find the conflicting program in Windows Task Manger, you can just right-click and stop the service.
    Stop service in Windows Task Manager

    Now that the program has been stopped, re-start Apache and XAMPP should work fine.

Don't miss out!
Subscribe To Newsletter

Receive the best WordPress, Git, Web development and programming tutorials.

Invalid email address
Give it a try. You can unsubscribe at any time.