XAMPP Apache not starting on macOS

XAMPP Apache not starting on macOS

XAMPP is a great tool for web developers who need to host websites locally on their own computer. Unfortunately, because it uses ports and services that are commonly used by other applications, conflicts can happen, causing certain applications on XAMPP to be unable to run.

In this article, we will we exploring what you can do if XAMPP’s Apache service does not run on a macOS platform.

We also have a guide if XAMPP Apache isn’t starting on your Windows device.

1. The problem

If all of your servers are running except Apache Web Server (like the below picture) then you are encouraged to read this article for possible causes and solutions to your problem.

XAMPP Apache is not starting
XAMPP Apache is not starting.

If you are unable to start Apache, on your XAMPP Control Panel, you will see a message saying httpd started, but Apache Web Server will not start:

Starting Apache Web Server...
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd started

2. Possible causes and fixes

Below are some common reasons for XAMPP’s Apache not starting in macOS devices.

a. Apache port conflicts

By default, Apache listens to the port 80 (the HTTP port), but if you see an error that says the port is already in use, like the message below, that means that another application is using this port.

(13)Permission denied: AH00072: make_sock: could not bind to address[::]:80
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down

In such a situation, you can either:

  1. Change the port for Apache, or;
  2. Find and close the other application (which is, for macOSes, most likely another version of Apache) using port 80.

Note: Before you start changing your port, you need to log in as a root user on your macOS machine. If you don’t know how to do so, you can find the answer in the following guide by Apple, which will take about 3 minutes to read: https://support.apple.com/en-us/HT204012

To change the port XAMPP Apache runs on:

  1. You need to find file by clicking to manager-osx in your XAMPP folder.
  2. Then choose Apache Web Server and click Configure. In the port field, change it to a new port, I suggest setting it to 8080 port.
  3. Having set a new port, click on Open Conf File to see the file we were looking for.
  4. Inside the file, we need to change port which Apache listens to, so search for the part that says Listen 80. You will need to change this number to the port that you keyed in the XAMPP Control Panel (i.e. if you have set the port to 8080 prior, then key in 8080).

Below is a short video illustrating the steps above:

After changing your port, note that you will have to specify the new port number you are using if you are accessing your site from the browser. For example, after changing your port to 8080, you will have to go to localhost:8080 instead of localhost to access the default XAMPP domain. Note also that any subdirectories or pages come after the 8080, so if you were to access, for instance, PHPMyAdmin, you will have to use localhost:8080/phpmyadmin.


Article continues after the advertisement:


b. Apache is already being run by another application

If port 80 is being used, it is likely that another copy of Apache is already running on your computer. For most macOS users, this is the most common issue stopping XAMPP’s Apache from running, because macOS comes pre-installed with Apache.

To disable the pre-installed version of Apache, open your Terminal and run the following command:

$ sudo apachectl stop

Also, to execute this command, you will have to know your root password. Once done, reboot XAMPP and try again.

sudo prompt when disabling macOS Apache
The password prompt when disabling the default Apache on macOS.

3. Conclusion

As with the other articles on the blog, we’d love if you leave a comment below, especially if you:

  1. Find any errors in this article.
  2. Find an XAMPP Apache issue that is not described in this article.

Your comments will add on to the information that is already here, and help other future readers!

There are 4 comments:

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: You can use Markdown to format your comments.

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.

This site uses Akismet to reduce spam. Learn how your comment data is processed.