There are two things that could be causing the issue: Apple’s built in web sharing service being active or zombie XAMPP processes still being active.
If this is caused by Apple’s web sharing you can handle this all by going to System Preferences…
and then selecting Sharing
. Once there, uncheck Web Sharing
—which is basically just Apache httpd
—and your problem should be solved.
That said, if this is basically a “zombie” instance of Apache running after some XAMPP tweaks, the best bet is to do something like the following:
First, run lsof
(list open files) which will list all of the files actively open on the system.
sudo lsof | grep MAMP | grep apache
Note the two grep
commands piped together? What I am doing is getting the list of open files, then filtering those which have a file path connected to MAMP—or in your case change that to XAMPP or whatever folder/directory you have it running in—and the I am filtering the apache
in the pathname. The list should look something like this:
httpd 2204 jake 2w REG 1,2 24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd 2211 jake 2w REG 1,2 24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd 2212 jake 2w REG 1,2 24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd 2213 jake 2w REG 1,2 24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd 2214 jake 2w REG 1,2 24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd 2215 jake 2w REG 1,2 24685 17953784 /Applications/MAMP/logs/apache_error.log
httpd 2216 jake 2w REG 1,2 24685 17953784 /Applications/MAMP/logs/apache_error.log
Okay, that is a whole list of processes. Apache runs on the concept of there being one parent process with many child processes spawned to deal with traffic. So if you kill a child process, the parent process notices it & respawns a new child.
Now looking at that list, typically the lowest number in that process list will be the parent—since it starts up before the other child process of course—so you should kill that to kill all processes. So in this case, the lowest number process in the list is 2204
, so just run this command:
kill 2204
And then the parent process is killed and all child processes should drop away as well. Then port 80
should be available again.